PDA

View Full Version : I am a new user here.and i begin to study shell



watermark1983
July 14th, 2007, 02:21 PM
am a new user here.and i begin to study shell...so even i dont know why i save this file below :
But this one does not when saved as <filename.sh>?

Code:

#!/bin/sh

echo "I will work out X*Y"
echo "Enter X"
read X
echo "Enter Y"
read Y
echo "X*Y = $X*$Y = $[X*Y]"


and where should i save this file ?and then how to run this file...
Is there anybody could give me some guide or any web pages here.thank you

jixuanliu
July 14th, 2007, 02:26 PM
i think you can save it somewhere in a file with an extension ".sh", assign it with executable permission and launch it by doing "./filename.sh".

alternatively you can also do "sh filename.sh"

watermark1983
July 14th, 2007, 02:38 PM
how to launch it ?
do you mean launch it in terminal or somewhere else ?

watermark1983
July 14th, 2007, 02:42 PM
i write this file "yang.sh" in /home/emma.
and when you said sh "yang.sh"..where should i run it?in terminal ?
will you please tell me the codes in details
thank you very much

watermark1983
July 14th, 2007, 02:46 PM
Okey.i have make it.thank you all the same

Mr. C.
July 14th, 2007, 10:40 PM
Here are some shell programming lessons:

http://cis68b1.mikecappella.com/
and basic Unix Introduction:
http://cis68a.mikecappella.com (under Coursework)

MrC

watermark1983
July 16th, 2007, 01:56 AM
Thanks a lot :)