Since Solaris grep by default doesn’t have the -E option, I would have to update my bash to work with a specific grep. This is what I do.
It works on the command line, but when I put it in the bash file, it looks like the script doesn’t pick it up and still uses the normal grep. (I do not want to change the whole $PATH.)
Please advise:
export isSolaris=`uname -a | grep -i "sunos"`
if [ -n "$isSolaris" ]; then
alias grep="/usr/xpg4/bin/grep -E";
fi
bashandkshdon’t process aliases defined in a file until after the file is read… which means you can’t define it in the same script that will use it. You can put it in another file and.(source) that into your script, though.Alternately, use a shell function.