It's UWAweek 47

helpOSTS

This forum is provided to promote discussion amongst students enrolled in Open Source Tools and Scripting.

Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

How do I ask a good question?
Displaying selected article
Showing 1 of 445 articles.
Currently 53 other people reading this forum.


 UWA week 14 (1st semester, non-teaching week) ↓
SVG not supported

Login to reply

👍?
helpful
9:39am Fri 5th Apr, Michael W.

Hi Suan, For example, let's say that the argument to this program is a word $1 being sought in a text $2 if [[ grep $1 $2 > /dev/null ]] then echo "The word: $1 is found in $2" else echo "The word: $1 is not found in $2" fi In this case we don't want all the instances, which are dumped to /dev/null so won't be seen by the user

Alternatively, if you are checking an argument to make sure it's greater than or equal to zero, the error message goes to /dev/stderr, which keeps the error handling away from /dev/stdout (the good stuff). Of course, you are able to combine the two streams if you wish

my_long_running_analysis > results 2>&1 &

This fires off the analysis asynchronously (&) and dumps both stdout and stderr into the file results.

Cheers MichaelW

Cheers MichaelW

If

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  8:08AM Aug 25 2024
Privacy policy