Use of Colon in Shell script

Use of Colon in Shell script

  • Sometimes it is useful to have a command which does “nothing”.
  • The : (colon) command in Unix does nothing

#!/bin/sh
if grep unix myfile
then
:
else
echo “Sorry, unix was not found”
fi

shell programming use of colon
shell programming use of colon