Difference between revisions of "Cat"

From Hackepedia
Jump to navigationJump to search
(some examples for cat.)
 
m (grammar correction.)
Line 1: Line 1:
 
Cat is a command to concatenate or just print files.. here is an example
 
Cat is a command to concatenate or just print files.. here is an example
  
  cat SHH.yt | head
+
  cat file | head
  
which would pipe the file SHH.yt to the program head.
+
which would pipe the file "file" to the program head.
  
 
An example improved cat would the following shell syntax:
 
An example improved cat would the following shell syntax:
Line 14: Line 14:
 
  done
 
  done
  
The above serves as a rudamentary cat, when it's missing in a s(h)y[st]em.
+
The above serves as a rudamentary cat, when it's missing in a system.

Revision as of 04:32, 6 June 2007

Cat is a command to concatenate or just print files.. here is an example

cat file | head

which would pipe the file "file" to the program head.

An example improved cat would the following shell syntax:

#!/bin/sh

while : ; do
 read i
 echo $i
done

The above serves as a rudamentary cat, when it's missing in a system.