[SWLUG] si,ple shell in bash not working
Terry John
terry.john at bbc.co.uk
Fri May 4 11:31:34 UTC 2007
[ choice < mid ] should be [ $choice -lt $mid ]
try
man test
have fun
Terry
-----Original Message-----
From: discuss-bounces at swlug.org [mailto:discuss-bounces at swlug.org] On
Behalf Of Stephen Constantinou
Sent: 04 May 2007 11:46
To: SWLUG
Subject: [SWLUG] si,ple shell in bash not working
Dear All
I thought I would refresh my script knowledge as I want to write a menu
in bash. I will use if's, while and other loops as well as read to take
in keyboard input. I made a very modest start and got stumped at the
very beginning.
I made an executable file called /home/stephanos/ShellScripts/Kaspersky
and here is the content:
<content starts>
choice=5
mid=7
if [ choice < mid ]
then
echo " choice is less than mid"
else
echo " choice is greater than mid"
fi
<content ends>
the output to screen is
[stephanos at localhost ShellScripts]$ ./Kaspersky
./Kaspersky: Line 3: mid: No such file or directory
choice is greater than mid
[stephanos at localhost ShellScripts]$
I put a $ at the beginning of choice and mid
if [ $choice < $mid ]
but the output was similar
[stephanos at localhost ShellScripts]$ ./Kaspersky
./Kaspersky: Line 3: 7: No such file or directory
choice is greater than mid
[stephanos at localhost ShellScripts]$
I read a very good online tutorial and I am lost as to what I have done
wrong.
Any help appreciated
Stephen
_______________________________________________
SWLUG Discussion List - Discuss at swlug.org
http://swlug.org/mailman/listinfo/discuss
http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
More information about the Swlug
mailing list