使用shell ubuntu中的文件进行操作

时间:2017-08-08 17:21:16

标签: shell

我是shell脚本的新手,这是一个在文件中创建,复制,追加操作的简单程序,但我不知道这段代码中的错误是什么

Q1.sh

echo "1.create a file\n"
echo "2.copy content of files\n"
echo "3.append files\n"

read ch

if $ch -eq 1
then
read file
cat > $file
fi
if $ch -eq 2
then
read file1 file2
cp $file1 $file2
fi
if $ch -eq 3
then
read file1 file2
cat $file1 >> $file2
fi

错误 当我按1时,它表示1未找到

0 个答案:

没有答案