Linux vs HP-UX cp command

October 14, 2010 at 11:09:29
Specs: Windows 7
in Linux, cp command can be used with '-v' switch to display the output on the screen

example:
$ cp -v abc.txt 123.txt
`abc.txt' -> `123.txt'

is there something similar to this on HP-UX so I can capture the output into a log?

Thanks in advance.


See More: Linux vs HP-UX cp command

Report •

#1
October 14, 2010 at 12:56:48
The non-GNU version of the cp command does not have a verbose option. You can sort of code for it:

#!/bin/ksh

xfile="x"
yfile="y"

cp $xfile $yfile
if [ $? -eq 0 ]
then
   echo "$xfile -> $yfile" > $(tty)
fi

By default, the standard output is the terminal. The tty command returns the user's terminal name, so the above script writes to the user's screen even if standard output is redirected to a file.


Report •
Related Solutions


Ask Question