Hi
I am trying to port some of my Linux scripts to my FreeBSD. In this regard, one of my scripts, the "mv" command uses (-b) option to make a backup of existing file in destination directory (instead of overwriting it). For instance, if the destination directory contains a file named "foo", so the script will rename it to "foo~" and then move the source file to destination.
I am looking for same functionality in "mv" in FreeBSD, however, the manpage of "mv" does not give any such option (to backup the original file). The closest I can get is "-i" option which prompts for overwriting, but it does not fulfill my objective. Maybe one way is to add a line something like:
But, I was wondering that whether it is possible to get this "backup creation" functionality in "mv" in FreeBSD?
Thanks
I am trying to port some of my Linux scripts to my FreeBSD. In this regard, one of my scripts, the "mv" command uses (-b) option to make a backup of existing file in destination directory (instead of overwriting it). For instance, if the destination directory contains a file named "foo", so the script will rename it to "foo~" and then move the source file to destination.
I am looking for same functionality in "mv" in FreeBSD, however, the manpage of "mv" does not give any such option (to backup the original file). The closest I can get is "-i" option which prompts for overwriting, but it does not fulfill my objective. Maybe one way is to add a line something like:
Code:
if [ -f $1 ] then mv $1 $1~
Thanks