Wednesday, November 30, 2022

Make a duplicate copy of a specified file using bash shell script

 #!/usr/bin/bash

#if [ $# -lt 2 ] || [ $#  -gt 2 ]

#if test $# -lt 2 -o  $#  -gt 2

#if [[ $# -lt 2 ]] || [[  $#  -gt 2 ]]

if  (($# < 2)) || ((  $#  > 2 ))


then

echo invalid

exit

else

echo file to be copied : $1

echo new file name : $2

cp $1 $2

echo copy successful




fi

No comments:

Post a Comment