Code:
echo Enter the file name
read fname
if [ -w $fname ]
then
echo Type text to append. To stop press Ctrl D.
cat >> $fname
else
echo The file has no write permission
fi
Output:
[ty2011330@localhost ~]$ sh per.sh
Enter the file name
b2
The file has no write permission
[ty2011330@localhost ~]$ sh per.sh
Enter the file name
prime.sh
Type text to append. To stop press Ctrl D.
No comments:
Post a Comment