[TynesideLUG] bash script - writing log file entries

Ian Bruntlett ian.bruntlett at gmail.com
Sat Mar 27 17:17:27 UTC 2021


Hi,

>From a conversation elsewhere, I came up with this shell script I called
expt-logging:-

#!/usr/bin/env bash
echo Normal standard output aka stdout or cout
echo Logging output aka stderr or cerr >&2
echo End of stdout

Here are the results of running it normally..
$ ./expt-logging
Normal standard output aka stdout or cout
Logging output aka stderr or cerr
End of stdout

Here are the results of sending stderr (fiie descriptor 2) to stdout (file
descriptor 1):-

$ ./expt-logging 2> /dev/null
Normal standard output aka stdout or cout
End of stdout

HTH,


Ian

-- 
-- ACCU - Professionalism in programming - http://www.accu.org
-- My writing - https://sites.google.com/site/ianbruntlett/
-- Free Software page -
https://sites.google.com/site/ianbruntlett/home/free-software


More information about the Tyneside mailing list