a bash scripting question
Hugh Esco
hesco at greens.org
Wed Aug 6 18:57:38 EDT 2003
You caught me away from my reference library, but essentially arguments on
the command line of a command that invokes a bash script are referenced as
$1, $2, $3, etc.
So you could, after your #!/bin/bash line, assign the arguments to your
variables like so:
VAR1 = $1
VAR2 = $2
I think. You may need to define them as $VAR1 and $VAR2, but I'm not
sure, try it both ways and see which works.
Also, if you have more than 9 arguments on the command line, you can use
the shift command to access those beyond $9.
The man page for bash is pretty thorough, as I recall.
-- Hugh
On Wed, 6 Aug 2003, Gregory Nowak wrote:
> Hi all.
>
> Can someone please tell me how to write a bash script that would accept 2
> arguments from the command line, where the first argument would be an
> integer like 1234567, and the second argument would be a text string?
> I would then like to be able to access the variables inside the script
> via $VAR1 and $VAR2.
>
> Thanks for any help.
>
> Greg
>
>
> --
> Free domains: http://www.eu.org/ or mail dns-manager at EU.org
>
>
> _______________________________________________
> Speakup mailing list
> Speakup at braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
>
More information about the Speakup
mailing list