Write a shell script to copy a file from one directory 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
read dn
if
[ -d “ $dn” ]
then
cp
$fname $dn
echo
“ $fname copied to $dn”
else
else
echo
“directory $dn does not exists”
fi
OUTPUT:
enter
a file
prime.sh
file
prime.sh exist
enter
a directory
dir
prime.sh
copied to dir
Comments
Post a Comment