Keep the existing PATH entries.
Append $HOME/bin at the end and export the result to child processes.
Which assignment is appropriate?
PATH is a colon-separated list of directories. Expand the existing value, append the new directory, and export it for child processes.
Detailed explanation
export PATH="$PATH:$HOME/bin"Correct. It preserves PATH, appends $HOME/bin, and exports the result.
Correct. It preserves PATH, appends $HOME/bin, and exports the result.
export PATH="$HOME/bin"Incorrect. It discards the existing standard search directories.
Incorrect. It discards the existing standard search directories.
export PATH='$PATH:$HOME/bin'Incorrect. Single quotes keep the variable names literal.
Incorrect. Single quotes keep the variable names literal.
PATH+="$HOME/bin"Incorrect. It omits the colon separator and does not use export.
Incorrect. It omits the colon separator and does not use export.
Try it yourself
An example you can run in a temporary verification environment.
bash --noprofile --norc -c 'HOME=/tmp/demo-home; PATH=/usr/bin:/bin; export PATH="$PATH:$HOME/bin"; printf "%s\n" "$PATH"'Expected result
/usr/bin:/bin:/tmp/demo-home/binKey points
- Entries are colon-separated
- Preserve the existing PATH
- Appending gives lower priority
Notes
- Environment: GNU Bash 5.2 / 一時シェル
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.