News for hackers. Stuff that matters.
Re:The string type is broken (2013) by paulmd on Tuesday June 22, 2021 @10:21PM (#27600070)
rev | cut | rev

is a pretty common idiom in the shell when you want to keep "all but the last N chunks" from some lines of input.

At least for me. I'm sure there's probably a better way, and performance of this is definitely notably poor.

And of course it's not like I'm actually writing the utility. ;)

Re:The string type is broken (2013) by marcosdumay on Tuesday June 22, 2021 @10:36PM (#27600154)
I would be very surprised if rev | cut | rev gave you the correct answer to anything that isn't "drop the last X lines or words" on a non western alphabet.

And for "drop the last X lines or words", you would do better with some specialized command.

Re:The string type is broken (2013) by paulmd on Wednesday June 23, 2021 @11:44AM (#27605831)
you don't ever work with directories? fortunately there is a pretty defined separator in my directory hierarchies, so that is pretty much always correct ;)

(although if you are taking arbitrary user data I suppose there is nothing stopping you doing something stupid like putting an escaped '/' in a filename, which would break this.)