December 16, 2014

Unexpected token fi

Forums: 

I am trying to run my command but it comes up with this error:
syntax error near unexpected token `fi' on line 7.

Here is my command:

if [ $# -gt 0 ]
then
if [ $1 = head ] || [$1 = tail ]
then
$1 -n $3
else
fi
fi

if [ -d $3 ]
then
echo "Directory selected exists"
else
echo "Directory selected does not exist"
fi

if [[ $2 = *[[:digit:[[* [[;
then
echo "value is a digit"
else
echo "$2 is not an integer"
fi

Click Here!