Reputation: 1
I inherited an perl script and trying it now on an Linux.
I have this command,
my $c = "$CONFIG_FILE.completed";
write_log "Moving to Done: $c\n";
chomp(my $qxout=qx(mv -t $DONE_DIR $c 2>&1));
logNdie "$PROGNAME: ERROR: Move to Done FAILED($?) for $c (output='$qxout')\n" if $?;
where $DONE_DIR = /pvc/ohdr/topology
But it fails to recognize the t option
I get
ohdr_cucp_sip_fix_04132022.pl: ERROR: Move to Done FAILED(256) for SIP_CUCP_FILES_VNISIPSUCCESS_20220414132902_1.cnfg.completed (output='mv: unrecognized option: t
Any solution?
Upvotes: 0
Views: 190
Reputation: 368
At first while looking at the documentation for mv I didn't see the '-t' option.
It looks like there are different implementations out there for mv. Most of the man pages I found do not mention the -t option.
I found documentation for mv here that mentions the -t option. I found another thread that mentions it also.
Since it isn't recognized on your platform you will need to find another solution or find a way to get the correct version of mv.
The -t option is supposed to specify a directory for moving a list of files into. Since you only have the file specified by $c you should be able to change this
mv -t $DONE_DIR $c 2>&1
to this:
mv $c $DONE_DIR 2>&1
Edit: Or, as ikegami pointed out, since -t protects from copying to a file named $c if the folder is missing, you can add a trailing slash to the destination like this:
mv $c $DONE_DIR/ 2>&1
I found a longer explanation at this SO thread.
Upvotes: 1