Do not show ls error in bash script
I've just started writing my own basg script so i;m kinda new to this all.
My script is going though some directories using a while loop.
In the llop i do an ls command but in some direcotries it gives back an error. That is just becuase there are no file matching the pattern (no files at all.
How can you supprees those errors? The errors mess up all my echo commands because i use echo -n some times.
This i a small example:
Try adding '2>/dev/null' on the end of offending commands. This redirects errors to /dev/null rather than output.
Thanks for your quick reply :D
|All times are GMT -5. The time now is 05:55 AM.|