Printing with proper tab spaces

Suppose, you want a command called print that expands tabs to four spaces and then prints it on the default printer. The program expand -4 expands tabs to 4 spaces. So we create a file called print.sh that contains the following.

#!/bin/sh
expand -4 $1 | lpr

Here $1 denotes the first command line argument passed to the script print.sh, the name of the file to print. Then we set the executable bit and move the print script to our bin directory.

chmod +x print
mv print ~/bin/

Now we have the print command available from anywhere. Note that you will need to have a directory named bin in your home directory for the above sequence of commands to work.