Redian新闻
>
新手unix shell script debugging help!
avatar
新手unix shell script debugging help!# Unix - 噫吁兮,危乎高哉
j*n
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.
avatar
T*l
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!"

avatar
j*n
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.
avatar
D*e
4
if后面的then丢了
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。