Usage of the $
like ${HOME}
gives the value of HOME. Usage of the $
like $(echo foo)
means run whatever is inside the parentheses in a subshell and return that as the value. In my example, you would get foo
since echo
will write foo
to standard out
More Related Contents:
- What is the difference between $(command) and `command` in shell programming?
- How to reload .bashrc settings without logging out and back in again?
- Are shell scripts sensitive to encoding and line endings?
- Difference between sh and Bash
- Command not found error in Bash variable assignment
- Pass commands as input to another command (su, ssh, sh, etc)
- Why would a correct shell script give a wrapped/truncated/corrupted error message? [duplicate]
- Why is testing “$?” to see if a command succeeded or not, an anti-pattern?
- Reading quoted/escaped arguments correctly from a string
- How can I remove the extension of a filename in a shell script?
- I just assigned a variable, but echo $variable shows something else
- How can I declare and use Boolean variables in a shell script?
- How do I run a shell script without using “sh” or “bash” commands?
- Ubuntu says “bash: ./program Permission denied” [closed]
- Assignment of variables with space after the (=) sign?
- How to echo shell commands as they are executed
- How to get a password from a shell script without echoing
- Count occurrences of a char in a string using Bash
- How to redirect output of an entire shell script within the script itself?
- How does Ctrl-C terminate a child process?
- source command not found in sh shell
- Can colorized output be captured via shell redirect? [duplicate]
- How to Batch Rename Files in a macOS Terminal?
- LINES and COLUMNS environmental variables lost in a script
- Should I use a Shebang with Bash scripts?
- Is there an elegant way to store and evaluate return values in bash scripts?
- Why would I create an alias which creates a function?
- Temporarily change current working directory in bash to run a command [duplicate]
- Why doesn’t my terminal output unicode characters properly?
- ^word^replacement^ on all matches in Bash?