2026-07-22 20:42 UTC
Replies (2)
-
@hyc@mastodon.social 2026-07-22 21:02
@fanf@mendeddrum.org an interesting historical dive, but I'm not convinced that the practice can safely be left behind. Nor do I understand why one would go to the trouble. It's not like testing "x$var" = "xval" is more expensive or less legible than omitting the 'x'.
-
@simon3270@fosstodon.org 2026-07-22 21:21
@fanf@mendeddrum.org I've been writing shell scripts for 50 years, and still use the "x-hack" (muscle memory!). As mentioned in the comments, the main use was for testing empty variables. The hack shouldn't be dismissed too readily - there are still commercial systems running with ancient shells where the hack is still needed. Even as various Bourne-style shells were fixed, you still needed the hack to write portable scripts where you didn't know which specific shell would be used to run it. Vive la "x"!