I have a bash script, but it gives me annoying output which I don't want to see. Of course I can hide it in that way:
./script.sh >/dev/null 2>&1
but I want to put the script in "rc.local" or "cron job", so it will be really bad if it received the output every 5 minutes for example, or on boot. It will be great if there is a way to tell the whole script to hide the output.
/dev/nulllike you're doing. Perhaps provide a more concrete example of what you're trying to do? You might be interested in this question which discusses suppressing output only if the command succeeds../script.sh >/dev/null 2>&1in rc.local or crontab?