#!/bin/bash
if [ $# -eq 0 ]
then
echo "missing arguments"
elif [ -d $1 ]
then
ls $1
elif [ -f $1 ]
then
cat $1
fi
#!/bin/bash
if [ $# -eq 0 ];then
echo "missing arguments"
elif [ -d $1 ];then
ls $1
elif [ -f $1 ];then
cat $1
else
echo error
fi
你的shell代码第三行语法上也是没有问题的,
功能上你要实现什么功能