0

Why the stomach of cat has ": No such file or directory" ?

#! /bin/bash
if [ $# != 1 ] ; then  
   echo wrong arg,please input one arg  
   exit 1;  
fi

if grep '^[[:digit:]]*$' <<< "$1";then  
    echo "$1 is number."  
else  
    echo "$1 is not number."
fi

if [ $1 -eq 1 ] ; then
   echo
'
        /\___/\
       /       \
      |  #    # |
      \     @   |
       \   _|_ /
       /       \______
      / _______ ___   \
      |_____   \   \__/
       |    \__/
       |       |
       /        \
      /   ____   \
      |  /    \  |
      | |      | |
     /  |      |  \
     \__/      \__/
'
elif [ $1 -gt 1 ] ; then
echo
'
        /\___/\
       /       \
      |  #    # |
      \     @   |
       \   _|_ /
       /       \______
      / _______ ___   \
      |_____   \   \__/
       |    \__/
'
i=1;
while [ $i -le $1 ]
   do
    echo '       |       |'
    i=`expr $i + 1`
   done
echo '       /        \
      /   ____   \
      |  /    \  |
      | |      | |
     /  |      |  \
     \__/      \__/
'
else
   echo wrong number,please input the right one  
   exit 1;  
fi

1 Answer 1

2

The error is in these lines (which occur twice):

if [ $1 -eq 1 ] ; then
   echo
'

The single quote must be on the same line as echo. If it is in the next line then is it not treated as argument to echo but as the next command.

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.