Welcome to the Linux Foundation Forum!
Unexpected token fi
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
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
0
Comments