Write a shell script to move a file from 1 dir to another?
echo
“enter a file”
read
fname
if
[ -f “$fname” ]
then
echo
“file $fname exist”
else
echo
“file not exist”
exit
fi
echo
“ enter a directory “
read
dn
if
[ -d “$dn” ]
then
mv
$fname $dn
echo
“$fname moved to $dn”
else
echo
“directory $dn doesnot exist”
fi
OUTPUT:
sh
mv filedir .sh
enter
a file
fact
.sh
file
fact .sh existenter a directory
dir
fact
.sh moved to directory
Comments
Post a Comment