SHELL SCRIPT TO COPY ONE FILE TO ANOTHER FILE | URDINESH

Software Programming, Tutorials, Interview Preparations,Stock Market,BSE/NSE, General informations

Wednesday, July 22, 2015

SHELL SCRIPT TO COPY ONE FILE TO ANOTHER FILE

COPY ONE FILE TO ANOTHER FILE:

echo "copying one file to another"
if [ $# -eq 4 ]
then
   cp $3 $1
   cp $4 $2
 fi
























OUTPUT:

[@localhost ~]$ cat f3
hai this is rajasekar
[@localhost ~]$ cat f4
i did my pg in nmc
[@localhost ~]$ sh copy.sh f1 f2 f3 f4
copying one file to another
[@localhost ~]$ cat f1
hai this is rajasekar
[@localhost ~]$ cat f2
i did my pg in nmc

No comments:

Post a Comment

Thanks for your valuable comments

Followers