I'd like to write a (korn) shell script that replaces the mv command so that it doesn't overwrite a file that already exists. I'd like it to function like the mv command so wish to type something like :
move /dir1/*.txt /dir2/
and have all files ending in .txt in dir1 moved to dir2 but only if the file doesn't already exist in dir2.
My problem is how can I refer to the destination (in this case /dir2/) in my shell script, as using positional parameters ($1 $2 $3 etc.) doesn't work because *.txt gets expanded and $1 $2 $3 etc. then refer to the expanded file list (for example, a.txt b.txt c.txt ...).
TIA
cardy
move /dir1/*.txt /dir2/
and have all files ending in .txt in dir1 moved to dir2 but only if the file doesn't already exist in dir2.
My problem is how can I refer to the destination (in this case /dir2/) in my shell script, as using positional parameters ($1 $2 $3 etc.) doesn't work because *.txt gets expanded and $1 $2 $3 etc. then refer to the expanded file list (for example, a.txt b.txt c.txt ...).
TIA
cardy