ciper
November 2nd, 2007, 03:16 AM
I am having trouble with the read command. For some reason it is not accepting any input.
For example if I run it directly from the bash prompt as follows
read test
and type
123
then run the set command I can see that an environment variable named test has been created but it is blank.
Once the read command has exited the string I typed (123 in this example) is then output to the bash prompt resulting in a command not found error.
The same thing happens in a script. For example
echo "enter password"
read password
echo $password
Will echo nothing and then whatever I typed during the script will then be entered at the next prompt with a "command not found" error.
Any ideas? Its pretty hard to google for something like this since the word "read" is so common.
For example if I run it directly from the bash prompt as follows
read test
and type
123
then run the set command I can see that an environment variable named test has been created but it is blank.
Once the read command has exited the string I typed (123 in this example) is then output to the bash prompt resulting in a command not found error.
The same thing happens in a script. For example
echo "enter password"
read password
echo $password
Will echo nothing and then whatever I typed during the script will then be entered at the next prompt with a "command not found" error.
Any ideas? Its pretty hard to google for something like this since the word "read" is so common.