Greetings,,, Mmmm, I hit a blank I know how to use read in conbination with echo, but have forgotten what we use for passing parameters to a script: for example If I write script called hello you would executei it like so : ./hello James capture James as a variable,,,, etc I just can't remeber how to do it. Please Help Thanks -- -- Chadley Wilson Production Line Superintendant Pinnacle Micro Manufacturers of Proline Computers ==================================== Exercise freedom, Use LINUX =====================================
On Monday 29 August 2005 1:59 pm, Chadley Wilson wrote:
Greetings,,,
Mmmm, I hit a blank
I know how to use read in conbination with echo, but have forgotten what we use for passing parameters to a script:
for example If I write script called hello
you would executei it like so :
./hello James
capture James as a variable,,,, etc Easy. #!/bin/bash read VAR echo $VAR -- Jerry Feldman
Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
On Monday 29 August 2005 2:06 pm, Jerry Feldman wrote:
On Monday 29 August 2005 1:59 pm, Chadley Wilson wrote:
Greetings,,,
Mmmm, I hit a blank
I know how to use read in conbination with echo, but have forgotten what we use for passing parameters to a script:
for example If I write script called hello
you would executei it like so :
./hello James
capture James as a variable,,,, etc
Easy. #!/bin/bash read VAR echo $VAR
Actually, I misread exactly what you wanted, still easy:
#!/bin/bash
#make sure you have at least 1 argument
if [ $# = 0 ];then
exit;
fi
echo $1
--
Jerry Feldman
On Monday 29 August 2005 20:18, Jerry Feldman wrote:
On Monday 29 August 2005 2:06 pm, Jerry Feldman wrote:
On Monday 29 August 2005 1:59 pm, Chadley Wilson wrote:
Greetings,,,
Mmmm, I hit a blank
I know how to use read in conbination with echo, but have forgotten what we use for passing parameters to a script:
for example If I write script called hello
you would executei it like so :
./hello James
capture James as a variable,,,, etc
Easy. #!/bin/bash read VAR echo $VAR
Actually, I misread exactly what you wanted, still easy: #!/bin/bash #make sure you have at least 1 argument if [ $# = 0 ];then exit; fi echo $1 -- Jerry Feldman
Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
Now where Did I put my brains? (Ha ha) Thanks guys I was going a bit over board, and missed the obvious. -- -- Chadley Wilson Production Line Superintendant Pinnacle Micro Manufacturers of Proline Computers ==================================== Exercise freedom, Use LINUX =====================================
On Monday 29 August 2005 2:31 pm, Chadley Wilson wrote:
Now where Did I put my brains? (Ha ha)
Thanks guys I was going a bit over board, and missed the obvious. Being a manager can do this to people :-) -- Jerry Feldman
Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
On Monday 29 August 2005 19:59, Chadley Wilson wrote:
Greetings,,,
Mmmm, I hit a blank
I know how to use read in conbination with echo, but have forgotten what we use for passing parameters to a script:
for example If I write script called hello
you would executei it like so :
./hello James
capture James as a variable,,,, etc
I just can't remeber how to do it.
Please Help
Thanks
#!/bin/bash echo "Hi, $1" ~> ./script James Hi, James
participants (3)
-
Anders Johansson
-
Chadley Wilson
-
Jerry Feldman