Assuming the user entered 2, the output of the program, according to everything that I have read, should be 1. However, the output is expr $num - 1. I have no idea why it is doing that instead of evaluating. I know the problem is related to surrounding the expression with ''. I tried another script that used the whoami command to check to see if it was being run by root. However, 'whoami' didn't output the user name but instead whoami.

Wynd

12-13-2005 09:24 PM

Try using `...` instead of '...'

`...` means "capture the output of the command", whereas '...' means "print it out exactly as it is - no substitutions or anything."