1

From https://www.gnu.org/software/bash/manual/html_node/Tilde-Expansion.html

If a word begins with an unquoted tilde character (‘~’), all of the characters up to the first unquoted slash (or all characters, if there is no unquoted slash) are considered a tilde-prefix.

From my experience or intuition (I am not sure which), "up to" means the following is included. But I am not sure if that is correct when reading the quote. So generally speaking does "up to" mean the following is included or not?

1 Answer 1

2

Up to does not include the slash. In your specific bash example:

~ gives you: $HOME
~/hello gives you: $HOME/hello

Only the "~" is substituted by "$HOME", the rest of the string is then parsed. The "/" is usually used as a delimiter and so is not included as part of any substitution string unless specifically escaped.

Usually up to and including the slash would mean "~/", and so up to means up to, but not including. If you walk up to a wall, you do not end up in the wall, you are just next to it...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .