monaspace icon indicating copy to clipboard operation
monaspace copied to clipboard

=~ on bash

Open massimo-cassandro opened this issue 2 years ago • 1 comments

I think that the =~ sequence may create confusione in bash scripts, when the ~ character is used to reference the user home dir:

MYPATH=~/path/to/something

becomes

Screenshot 2023-11-20 alle 09 51 33

Could it be useful to create new ligatures sets for this?

massimo-cassandro avatar Nov 20 '23 08:11 massimo-cassandro

I personally recommend against using ~ in scripts like that, as it makes it harder to quote the path, which is useful if the path possibly includes spaces or special characters.

# not ideal - breaks on spaces and some special characters
MYPATH=~/path/to/something

# not ideal - stores the actual tilde (~) character
MYPATH="~/path/to/something"

# better - more resilient against spaces and special chars
MYPATH="$HOME/path/to/something"

MoshiBin avatar Nov 21 '23 21:11 MoshiBin

Fixed in ca8015b27bdc6d8e1201b1ad722f4ae3c38970d0

idan avatar May 03 '24 23:05 idan