Skip to content

Files

Latest commit

 

History

History
33 lines (19 loc) · 903 Bytes

SC2147.md

File metadata and controls

33 lines (19 loc) · 903 Bytes

Pattern: Use of literal ~ in PATH

Issue: -

Description

Having literal ~ in PATH is a bad idea. Bash handles it, but nothing else does.

This means that even if you're always using Bash, you should avoid it because any invoked program that relies on PATH will effectively ignore those entries.

For example, make may say foo: Command not found even though foo works fine from the shell and Make and Bash both use the same PATH. You'll get similar messages from any non-bash scripts invoked, and whereis will come up empty.

Use $HOME or full path instead.

Example of incorrect code:

PATH="$PATH:~/bin"

Example of correct code:

PATH="$PATH:$HOME/bin"

Exceptions

If your directory name actually contains a literal tilde, you can ignore this message.

Further Reading