I wanted to directly comment on another post asking the person directly, but I cannot comment, and it doesn't seem like I can message him either therefore I will ask the good community for assistance.
On the post in question (found here) I have been reading the man page... but I do not understand how the following code works.
srv=`expr "$SERVER" : '^\(db\|bk\|ws\)-[0-9]\+\.host\.com$'`
echo -n "$SERVER : "
case $srv in
ws) echo "Web Server" ;;
db) echo "DB server" ;;
bk) echo "Backup server" ;;
*) echo "Unknown server !!!"
esac
Taking this line by line, I understand that the input to the script ($#)would be compared by the expr command to the latter stated regex... and that the output of that would be 0, 1, 2, or 3. The output would then be stored into the $svr variable...
Unless I am misunderstanding the code... wouldn't that mean that the answer would always be:
"Unknown server !!!"
I appreciate the help in advance!! Thank you!