Xafer
May 25th, 2010, 02:03 AM
Sorry for asking questions simultaneously, I just curious with this Ubuntu :)
So, I would like to make a simple Bash code that read the users input.
#!/bin/bash
echo "Enter input"
read input
if [$inputan =1]
then
echo "You choose one"
else
echo "You choose other than one"
fi
So, when the users put 1, it will show a text "You choose one"
else, it will show "You choose other than one". The problem is whenever my input is, I always get this output
Enter input:
5
[: 9: missing ]
You choose other than one
So, I would like to make a simple Bash code that read the users input.
#!/bin/bash
echo "Enter input"
read input
if [$inputan =1]
then
echo "You choose one"
else
echo "You choose other than one"
fi
So, when the users put 1, it will show a text "You choose one"
else, it will show "You choose other than one". The problem is whenever my input is, I always get this output
Enter input:
5
[: 9: missing ]
You choose other than one