Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "$*" at the end of a shell command mean

Tags:

linux

shell

In a sample shell script, the command was -

. <sourced_file.sh> $*

What does the $* mean? Thanks.

like image 371
Sumod Avatar asked Dec 12 '22 06:12

Sumod


1 Answers

$* expands to all of the arguments that were given to the script in which it appears, or to the current shell function if it appears inside a function.

It's usually incorrect usage though, because it breaks arguments that contain spaces into multiple arguments. More correct is "$@" which preserves the original arguments even if they have spaces in them.

like image 87
Celada Avatar answered Dec 30 '22 05:12

Celada