LinuxCommandLibrary

$

Execute a command as a user

TLDR

Print a variable

$ echo $[VARIABLE]
copy

Print the exit status of the previous command
$ echo $?
copy

Print a random number between 0 and 32767
$ echo $RANDOM
copy

Print one of the prompt strings
$ echo $[PS0|PS1|PS2|PS3|PS4]
copy

Expand with the output of command and run it. Same as enclosing command in backtics
$ $([command])
copy

List how many arguments the current context has
$ echo $#
copy

Print out a Bash array
$ echo ${array[@]}
copy

Copied to clipboard