-2
#!/bin/sh
read -p "Input a file or directory what you want " x
for FILENAME in `ls`
do
if [ -e $FILENAME ]
then
echo "File exist" #if file exist, you should show me that is it a directory
# or symboliclink ...for so on like that
elif [ -d $FILENAME ]
then
echo " It is a directory"
elif [ -L $FILENAME ]
then
echo " It is a symbolic link"
elif [ -c $FILENAME ]
then
echo " It is a character tool file"
elif [ -b $FILENAME ]
then
echo " It is a block tool"
elif [ -p $FILENAME ]
then
echo " It is a pipe "
elif [ -S $FILENAME ]
then
echo " It is a socket"
elif [ -f $FILENAME ]
then
echo " It is a ordinary file"
else
echo " file isn`t exist"
fi
done
的錯誤消息是我不知道什麼是錯我的代碼
./fn: line 43: unexpected EOF while looking for matching ``'
./fn: line 48: syntax error: unexpected end of file
'=撇號,'=反向。 「不」需要一個撇號,而不是一個反作用。 – PSkocik