commandline session
$cat test.sh #!/usr/bin/env bash # cookbook filename: checkfile # DIRPLACE=/tmp INFILE=/home/jeffrin/amazing.data OUTFILE=/home/jeffrin/more.results if [ -d "$DIRPLACE" ] then cd $DIRPLACE if [ -e "$INFILE" ] then if [ -w "$OUTFILE" ] then doscience > "$OUTFILE" else echo "can not write to $OUTFILE" fi else echo "can not read from $INFILE" fi else echo "can not cd into $DIRPLACE" fi $sh test.sh can not read from /home/jeffrin/amazing.data $> /home/jeffrin/amazing.data $sh test.sh can not write to /home/jeffrin/more.results $> /home/jeffrin/more.results $sh test.sh test.sh: 14: test.sh: doscience: not found $
related source : Bash CookBook