Monday, 11 November 2013

What is wrong with this interactive shell script?

echo What month is this?
read $month
echo $month is as good a month as any.
Answer: Initially, the question mark should be escaped (\?) so that it is not interpreted as a shell metacharacter. Second, it should be read month, not read $month.

No comments: