How to remember which expansion ${var%} ${var#} work from which end? [closed] How to remember which expansion ${var%} ${var#} work from which end? [closed] bash bash

How to remember which expansion ${var%} ${var#} work from which end? [closed]


Percent symbols % always come last in numbers (e.g. 86%), so they remove from the end.

The hash symbols # start comments, so they remove from the start.


Remember only 1 and other will be Opposite of it.

# Shebang starts from a hash which means it will remove from starting till pattern, if you remember this and you know what other does IMHO :)


For keyboards of US English layout, # is on the left and % on the right.