I would like to display a message when calling custom_script -h
currently my simple script is using sed
stream editor
and when trying something like :
sed -i "myscript_here"
if [ "$1" == "-h" ]; then
echo "Usage: `custom_script $0` [Help_message_here]"
exit 0
fi
Then I'm getting sed's message first and only then my help message
sed: invalid option -- 'h'
Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]...
-n, --quiet, --silent
suppress automatic printing of pattern...................
............................
''''''''''''''''''''''''''''
GNU sed home page: <http://www.gnu.org/software/sed/>.
General help using GNU software: <http://www.gnu.org/gethelp/>.
sed: no input files
/usr/local/bin/comment.sh: line 5: custom_script: command not found
**Usage: [Help_message_here]**
How can I omit/hide sed's message and display only mine help message ?