Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Why the stomach of cat has ": No such file or directory" ? Help me please!

#! /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
share|improve this question

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
    
It works! Thank you! –  Yunong Nov 26 '14 at 16:29
    
@Yunong Then you may accept (unix.stackexchange.com/help/accepted-answer) my answer so that the others see that your problem has been solved. –  Hauke Laging Nov 26 '14 at 16:34
    
is that OK? I accepted it! –  Yunong Nov 26 '14 at 18:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.