Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- red=`echo -en "\e[31m"`
- normal=`echo -en "\e[0m"`
- # fatal uses SIGUSR1 to allow clean fatal errors
- trap "exit 1" 10
- PROC=$$ # this will get the current bash script id
- function error(){
- echo -e "${red}$@${normal}" >&2
- # exit 1
- kill -10 $PROC
- }
- [[ "$1" ]] || error "Error:\nInput file needed\nExample: $0 'file.txt'"
- [[ -f "$1" ]] || error "'${1}' file does not exist."
- [[ "$2" ]] || (echo "Thank you for your input";error "'$1' exists";echo "Exiting Script")
- echo "This should never output"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement