我创建了一个脚本,它创建两个文件并在两个文件不同时反转它们的内容。我无法理解如何解决此错误:
[:我的文件名:shell编程中的意外错误
代码:
echo "Enter first filename :"
read file1
echo "Enter second filename:"
read file2
echo "Enter content of file 1 : "
gedit $file1
echo "Enter content of file 2 : "
gedit $file2
check=" "
x=` cmp $file1 $file2 `
if [ $x -eq $check ]
then
echo "Both files are same"
rm $file2
echo "Redundant file removed!!!"
else
echo "They are different"
fi
tac $file1 | cat > temp1
rev temp1 | cat > temp11
tac $file2 | cat > temp2
rev temp2 | cat > temp22
mv temp11 $file1
mv temp22 $file2
echo "Content of both the files reversed"