If the whole output of the complex script should be redirected to the log, the following trick could be used.
if [ "$1" != "-log" ] ; then
$0 -log "$@" 2>&1 | tee the_log_file.$$.log [...]
|
||||||||
|
If the whole output of the complex script should be redirected to the log, the following trick could be used. if [ "$1" != "-log" ] ; then echo $PATH| awk -v RS=":" ‘{ print $0 }’ echo $LD_LIBRARY_PATH |awk -v RS=":" ‘{ system ( "ls -rltd " $0 ) }’ Warning! To check if the new version of awk is installed: awk 1 /dev/null The output will be empty for new awk. Only the short info about Sybase database devices. Warning! It was not tested for all possible configurations, so the result could be incorrect on [...] Here is the shell command snippet to display comma-separated output: ls -lrt | rev | sed ‘s/\\([0-9][0-9][0-9]\\)/\\1,/g’ | rev | sed ‘s/\\([\^0-9]\\),\\([0-9]\\)/\\1\\2/g;s/\^,\\([0-9]\\)/\\1/g’ Example: Rev in awk #!/bin/ksh Rev function (absent on SunOS) : (Warning! [...] |
||||||||
|
Copyright © 2010 MemoSoup - All Rights Reserved
|
||||||||