Re: what does "!*" do in shell script? (110 Views)
Reply
Super Advisor
Henry Chua
Posts: 444
Registered: ‎09-05-2004
Message 1 of 6 (110 Views)
Accepted Solution

what does "!*" do in shell script?

Recently I encounter a line in a shell program that I dun quite understand..
i.e. :
"'onintr -;T0 path $planpath \!*;T1 start \!* $t2;onintr "

T0, T1, and t2 all are assigned value in intial declaration..
what I am interested to know is what does these commands do and especially
what does the "!*" serve as.. ?
Please use plain text.
Trusted Contributor
Manish Srivastava
Posts: 170
Registered: ‎05-24-2004
Message 2 of 6 (110 Views)

Re: what does "!*" do in shell script?

Hi,

In bash it gives the arguments of the last executed command.

manish
Please use plain text.
Super Advisor
Henry Chua
Posts: 444
Registered: ‎09-05-2004
Message 3 of 6 (110 Views)

Re: what does "!*" do in shell script?

ic.. but how does it works?.. in this case.. or maybe an example to illustrate?...

thank you all for your advise!
Please use plain text.
Frequent Advisor
Michael_356
Posts: 69
Registered: ‎09-21-2003
Message 4 of 6 (110 Views)

Re: what does "!*" do in shell script?

onintr : Controls the action of the shell on interrupts.
If - is specified, all interrupts are ignored.

The end of the line reset the interrupts-command

Regards

Michael
Please use plain text.
Honored Contributor
Rodney Hills
Posts: 1,679
Registered: ‎09-09-1996
Message 5 of 6 (110 Views)

Re: what does "!*" do in shell script?

onintr is a "csh" internal command and !* returns the last commands arguments into the command string (like bash).

The code you have turns off interupts, runs the program specified by T0 passing parameter "path $planpath" followed by the arguments from the command line that launched the script, then the program specified by T1 is run passing argument "start" followed by the command line arguments again, followed by "$t2".
The onintr at the end resets the "on interupt flag".

HTH

-- Rod Hills
There be dragons...
Please use plain text.
Super Advisor
Henry Chua
Posts: 444
Registered: ‎09-05-2004
Message 6 of 6 (110 Views)

Re: what does "!*" do in shell script?

SOLVED .THANKS!!
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation