Skip to contentSkip to conversation

Passing the entire command line

DISCUSSION Adam Luchjenbroers 4 participants 4 messages Nov 16, 2002 – Nov 18, 2002

lore
Share & tools
lore
#0 lore raw

While bash can retrieve the different commandline values using the variables $1, $2, $3, etc - is there a way to just read out them all at once (with spaces between the values).

I use startup scripts for many of my games, and I want the script to pass through command line options at the end (for connecting to servers, etc).

Signature · 9 lines
Linux...
"Find out what you've been missing while you've been rebooting Windows NT." 
-Infoworld

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
#1 lore raw
Quoted 7 lines · Adam Luchjenbroers

While bash can retrieve the different commandline values using the variables $1, $2, $3, etc - is there a way to just read out them all at once (with spaces between the values).

I use startup scripts for many of my games, and I want the script to pass through command line options at the end (for connecting to servers, etc).

mdresser@router:~$ cat testingforadam
echo $*
mdresser@router:~$ ./testingforadam hello adam how are you today
hello adam how are you today

=)

Mike

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#2 lore raw
In reply to Adam Luchjenbroers

Put them between ""

----- Original Message -----
From: "Adam Luchjenbroers" <[email protected]>
To: <[email protected]>
Sent: Friday, November 15, 2002 9:05 PM
Subject: Passing the entire command line

Quoted 2 lines

While bash can retrieve the different commandline values using the

variables

Quoted 9 lines

$1, $2, $3, etc - is there a way to just read out them all at once (with spaces between the values).

I use startup scripts for many of my games, and I want the script to pass through command line options at the end (for connecting to servers, etc).

--
Linux...
"Find out what you've been missing while you've been rebooting Windows

NT."

Quoted 7 lines
(quoted diff) +0 -2
-Infoworld
 
-

To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#3 lore raw
Quoted 6 lines

----- Original Message -----
From: "Adam Luchjenbroers" <[email protected]>
To: <[email protected]>
Sent: Friday, November 15, 2002 9:05 PM
Subject: Passing the entire command line

Quoted 9 lines
Quoted 1 line

While bash can retrieve the different commandline values using the

variables

Quoted 5 lines

$1, $2, $3, etc - is there a way to just read out them all at once (with spaces between the values).

I use startup scripts for many of my games, and I want the script to pass through command line options at the end (for connecting to servers, etc).

The special variable $* (dollar-sign asterisk) contains ALL of the positional parameters, regardless of how many they are. This is obiviously useful when you do not know how many variables will be passed. The variable $0 stands for the actual command. More details can be found here:

http://www.linux-tutorial.info/cgi-bin/display.pl?33&0&0&0&3

Regards,

jimmo

Signature · 14 lines
---------------------------------------
"Be more concerned with your character than with your reputation. Your
character is what you really are while your reputation is merely what others
think you are." -- John Wooden
---------------------------------------
Be sure to visit the Linux Tutorial:  http://www.linux-tutorial.info
---------------------------------------
NOTE: All messages sent to me in response to my posts to newsgroups, mailing 
lists or forums are subject to reposting.
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs