Shuman
Shuman

Reputation: 4132

What does !* mean in tcsh shell?

such as command

myCommand !* &

& is run in bg, but what is !* ? Can not find it anywhere, c shell is not used anywhere nowadays ...

Upvotes: 4

Views: 7336

Answers (1)

Barmar
Barmar

Reputation: 780899

! is the start of a history substitution. !* means "all the arguments from the preceding command".

So if you first do:

echo foo bar baz

and then do

myCommand !* &

the second command is equivalent to:

myCommand foo bar baz &

If this is part of an alias definition, the "preceding" command is actually the invocation of the alias. So if you write

alias myc 'myCommand !* &'

Then writing

myc foo bar baz

is expanded into

myCommand foo bar baz &

Upvotes: 7

Related Questions