j******n 发帖数: 2206 | 1 #!/bin/sh
# show script
if [ "$1" ]
if [ -d $1 ]
then
ls $1
if [ -f $1 ]
then
cat $1
else echo "File does not exist!"
fi
else
echo "you must give an argument"
fi
大家帮我看看这个程序哪里有问题?原题目是
2) Write a modified version of the show example script (the first example of
the if-statement given above), which prints out the message "File does not
exist" if the user gives a name which isn't a file or directory, and the
message "You must give an argument" if the user doesn't give an argument to
the program. | T**********l 发帖数: 12149 | 2
【在 j******n 的大作中提到】 : #!/bin/sh : # show script : if [ "$1" ] : if [ -d $1 ] : then : ls $1 : if [ -f $1 ] : then : cat $1 : else echo "File does not exist!"
| j******n 发帖数: 2206 | 3 #!/bin/sh
# show script
if [ "$1" ]
if [ -d $1 ]
then
ls $1
if [ -f $1 ]
then
cat $1
else echo "File does not exist!"
fi
else
echo "you must give an argument"
fi
大家帮我看看这个程序哪里有问题?原题目是
2) Write a modified version of the show example script (the first example of
the if-statement given above), which prints out the message "File does not
exist" if the user gives a name which isn't a file or directory, and the
message "You must give an argument" if the user doesn't give an argument to
the program. | D****e 发帖数: 9 | |
|