[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

unexpected script output



Good morning,

Can anyone help me understand why the following two console commands each
produce output, but only one of them produces output when both are called in a
shell script?

$ /bin/echo "Shell: $SHELL"
Shell: /bin/bash
$ /bin/echo "Random: $RANDOM"
Random: 29707

$ cat output.sh
#!/bin/sh
/bin/echo "Shell: $SHELL"
/bin/echo "Random: $RANDOM"

$ sh output.sh
Shell: /bin/bash
Random:

Why is there no output from the call to $RANDOM in the script?

Thanks,
Nelson
 		 	   		  

Reply to: