set
command changes/resets the output value of internal command/scripts
- One use for this is to toggle option flags which help determine the behavior of the script.
- Sets the positional parameters to the output of the command (eg:
uname -a
)
$ uname -a
MINGW64_NT-10.0-18362 cuongtrinh 3.1.7-340.x86_64 2000-10-12 16:29 UTC x86_64 Msys
- After doing:
set $(uname -a)
- The outputs now returns to: a list of positional parameters (So cool!!!)
$ echo $_
Msys
$ echo $-
himBHs
$ echo $1
MINGW64_NT-10.0-18362
$ echo $2
cuongtrinh
...