Shell Scripting Tutorial – 3


I am Aaditya Purani. I would be presenting tutorial 3 on Shell Scripting Tutorial

It’s common in Linux to pipe a series of simple, single purpose commands together to create a larger solution tailored to our exact needs. The ability to do this is one of the real strenghs of Linux. It turns out that we can easily accommodate this mechanism with our scripts also. By doing so we can create scripts that act as filters to modify data in specific ways for us.

Bash accomodates piping and redirection by way of special files. Each process gets it’s own set of files (one for STDIN, STDOUT and STDERR respectively) and they are linked when piping or redirection is invoked. Each process gets the following files:

  • STDIN – /proc/<processID>/fd/0
  • STDOUT – /proc/<processID>/fd/1
  • STDERR – /proc/<processID>/fd/2

To make life more convenient the system creates some shortcuts for us:

  • STDIN – /dev/stdin or /proc/self/fd/0
  • STDOUT – /dev/stdout or /proc/self/fd/1
  • STDERR – /dev/stderr or /proc/self/fd/2

fd in the paths above stands for file descriptor.




while read line
echo “$line”;

done < “${1:-/dev/stdin}”

So thanks for Reading a video tut is here:

Please contact me  :


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s