/usr/bin/rsync -avh -r /Parent/Folder1 /Destination/if [ $? == 0 ]then   cp /FolderCopyStatus/Success /Result/Success$(basename !:3)else   cp /FolderCopyStatus/Failure  /Result/Failure$(basename !:3)fiQuestion 1I am using rsync command to sync two folders in cent os.If rsync command is successful then I copy a folder to Result directory from Success directory and append current date.This works fineWhat I want is that when I copy from success instead of appending date,Folder1 from the above command should be appended.So how? Question 2I have automated this shell script in crontab.I want to pass Folder1 as parameter to the command in the automated script.So how??Update: if [ $? == 0 ]    then       cp /FolderCopyStatus/Success /Result/Success$(basename !:3)    else       cp /FolderCopyStatus/Failure  /Result/Failure$(basename !:3)    fiProblem: $(basename !:3) doesnot works in script but works in normal command like echo $(basename !:3)
Using previous command parameter in shell script
shell script;cron;rsync