3 ms·
So, it's not for me, especially given the examples. As usual with these kinds of things (fish, zsh, etc) this really has everything to do with taste, especially
by noobermin 2y ago
So, it's not for me, especially given the examples. As usual with these kinds of things (fish, zsh, etc) this really has everything to do with taste, especially since bash has such a difficult syntax...at least for those who aren't used to it. Even to this day, years later, I have to look up bits and pieces here and again if I don't use some of the ${}-type substitutions frequently.
- xiaq 2y ago> Even to this day, years later, I have to look up bits and pieces here and again if I don't use some of the ${}-type substitutions frequently. In that case I think you should give Elvish a chance then :) Honestly one of the motivations for writing a shell language was that I could never remember which of ${x%y} and ${x#y} is for trimming the suffix vs prefix. So Elvish just use function syntax - "str:trim-suffix $x y" and "str:trim-prefix $x y" - which I highlighted in the explainer of the first snippet (https://elv.sh/learn/scripting-case-studies.html#jpg-to-png.elv https://elv.sh/learn/scripting-case-studies.html#jpg-to-png....).
- saurik 2y ago# is to the left of $ and removes the prefix. % is to the right of $ and removes the suffix.
- SpaghettiCthulu 2y agoI, like the person you replied to, will surely remember it for good thanks to your reminder.
- saurik 2y agoI mean, people learn silly things all the time; I think, often, learning the pattern behind something can make a thing much more transparent... I, too, struggled with this particular distinction until I realized that the choice of characters wasn't, in fact, arbitrary.