Shell

Shell

Made by DeepSource

Consider using $HOME instead of tilde ~ to expand in quotes SH-2088

Bug risk
Major

Problematic code:

rm "~/Desktop/$filename"

Correct code:

rm "$HOME/Desktop/$filename"

Rationale:

Tilde does not expand to the user's home directory when it's single or double-quoted. Use double quotes and $HOME instead.

Alternatively, the ~/ can be left unquoted, as in rm ~/"Desktop/$filename".

Exceptions

If you don't want the tilde to be expanded, you can ignore this issue.