由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - 新手unix shell script debugging help!
相关主题
Shell script求教how to get the backgroup run state?
奇怪的 printf!! ksh programming提示我 too many ('s 怎么办?
请教:有关位置参数的问题。新手求助shell script
向高人请教:怎么从大量的文件中grepquestion about Makefile
有关Unix shell script的问题使用 AWK 中的问题
Need urgent help on a samll shell script problem!UNIX command to
[转载] Re: shell script questionHelp in GCC linking!!!Thank a lot
One shell questionls/mv/rm argument list too long error
相关话题的讨论汇总
话题: file话题: argument话题: script话题: give话题: echo
进入Unix版参与讨论
1 (共1页)
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
4
if后面的then丢了
1 (共1页)
进入Unix版参与讨论
相关主题
ls/mv/rm argument list too long error有关Unix shell script的问题
Re: 为什么emacs自动给我加^M.Need urgent help on a samll shell script problem!
一个关于命令行的小问题[转载] Re: shell script question
[转载] a simple but weird question about the usage of "test" in RH6.2 !One shell question
Shell script求教how to get the backgroup run state?
奇怪的 printf!! ksh programming提示我 too many ('s 怎么办?
请教:有关位置参数的问题。新手求助shell script
向高人请教:怎么从大量的文件中grepquestion about Makefile
相关话题的讨论汇总
话题: file话题: argument话题: script话题: give话题: echo