I'm really new to Unix and currently I need to make an alias that checks a file whether it is regular and readable. If its irregular, then I need to return 1 as the exit code and not test if its readable. If its unreadable, I need to return 2 as the exit code.
alias test="if [ ! -f filename ] ; then echo 'Irregular file'; exit 1 ; fi; if [ ! -r filename ]; then echo 'Unreadable file'; exit 2; fi;
The problem is now when I run it, the exit will close my entire client. Any way to get around this?