News for hackers. Stuff that matters.
Re:Don't Put Tilde In Your Path by CodesInChaos on Sunday October 11, 2026 @10:34AM (#50043732)
Unfortunately half of its badness isn't isn't the shell itself, but the convention of how parameters are passed to processes on Unix systems.
Re:Don't Put Tilde In Your Path by hnlmorg on Sunday October 11, 2026 @12:19PM (#50044862)
That’s not correct because POSIX passes what is ostensibly an array of strings.

Windows, on the other hand, only passes one string. So it’s up to the application to choose how to handle whitespace, quotation marks, and other nuances with parsing parameters.

Variable expansion in Bash is lazy. But there’s no reason why variables cannot be tokenised so that strings with spaces aren’t treated as multiple parameters. And in fact that’s exactly how some other shells work, such as the one I maintain.

Re:Don't Put Tilde In Your Path by CodesInChaos on Sunday October 11, 2026 @04:51PM (#50047690)
While unix handles splitting into an array of strings, it still leaves parsing those strings up to the application. One of the bigger problems is the ambiguity caused by filenames starting with `-`. Some applications support the `--` marker to end such parsing, but it's inconsistently implemented and the caller has to actively remember to use it.

A typed array (e.g. by having a required single byte marker at the start of each string), or even nested structures similar to s-expressions would have avoided this.

Re:Don't Put Tilde In Your Path by hnlmorg on Sunday October 11, 2026 @06:47PM (#50048789)
Funny enough, I’ve actually spent a long time trying to figure out how to solve this problem in murex but it always comes back to the same problem: anything smart I implement into the shell is immediately lost the moment I call fork().

I even considered writing a wrapper around some commands to send -- regardless of whether the user includes it or not. But that’s error prone too because

1. it’s a GNUism so you can’t guarantee compatibility with any tools that don’t call GNUs flag parsing library (which is particularly problematic outside of Linux)

2. If there a file called “-f” (for example), how do you know if the user intended that to be called as a file reference or a command flag? You then need to bake in a bunch of additional syntax sugar to make that explicit. Which results in a pretty awful user experience

3. The maintenance overhead for this would be astronomical

If UNIX were designed from day one to have that parameter type passed then this would be a very simple problem to solve. But the PDP machine UNIX was originally designed to run on wouldn’t have been powerful enough for that anyway. So once again we are limited by an architecture designed to run on mid-range systems of the 1970s.

Re:Don't Put Tilde In Your Path by sysguest on Sunday October 11, 2026 @11:38AM (#50044436)
yeah but... that convention is so much of a security/bug headache

sometimes, its footguns seem worse than javascript...

hope some typescript-like "typed shell" becomes mainstream someday

Re:Don't Put Tilde In Your Path by coldpie on Sunday October 11, 2026 @12:07PM (#50044748)
> hope some typescript-like "typed shell" becomes mainstream someday

The trouble with trying to invent a new, more robust shell language is you basically just end up re-inventing any number of scripting languages (eg Perl, Python, awk, ...), so you might as well use one of those.

Re:Don't Put Tilde In Your Path by hnlmorg on Sunday October 11, 2026 @12:26PM (#50044937)
Most regular programming languages aren’t well suited for shells because they have a verbose syntax due to their readability goals. But with a shell, the vast majority of times you’re typing in stuff that you have no intention of reading back ever again.

I’ve done a fair amount of research here and I actually think we do need a new programming language for the shell (and then I created one).

I wrote a blog about this problem: https://murex.rocks/blog/split_personalities.html#conclusion

Re:Don't Put Tilde In Your Path by coldpie on Sunday October 11, 2026 @01:04PM (#50045342)
Excellent article, thanks for the link. I do agree with the premise. But every time I write some Bash code and think there should be a better way to do this, I ask myself why I don't just learn Perl. I dunno. Feels like inventing another solution would just hit the old "there are now 14 standards" problem where it would solve some problems but introduce others (see: PowerShell).
Re:Don't Put Tilde In Your Path by hnlmorg on Sunday October 11, 2026 @01:27PM (#50045589)
I don’t disagree with you per se. But if the new shell solves enough annoying problems then I think it has merit in existing.
Re:Don't Put Tilde In Your Path by NetMageSCW on Monday October 12, 2026 @02:41PM (#50060872)
But then you run into the problem that you’ve learned a new language and built new scripts that only you can use.

I use Take Command (well, mostly TCC) in my Windows workstations but no one else does, so TCC specific batch files and aliases only work for me.

Re:Don't Put Tilde In Your Path by hnlmorg on Monday October 12, 2026 @07:59PM (#50064750)
If you’re vastly more productive using these alternatives then it would be silly not to use them.

If your colleagues want to reuse the same scripts then they can install the runtime too. It doesn’t mean they need to write all their future scripts using that runtime.

Re:Don't Put Tilde In Your Path by Greed on Monday October 12, 2026 @03:36AM (#50052708)
> so you might as well use one of those.

Did someone say... Xonsh?! It's tough to give up the niceties of zsh and it's various plug-in ecosystems, but I would love to be able to use Xonsh [1] as a daily driver for exactly the reasons stated. It is already the language I lean on over bash for most utility scripts with its kitchen sink built-ins.

[1] https://xon.sh/

Re:Don't Put Tilde In Your Path by coldpie on Monday October 12, 2026 @10:06AM (#50056685)
Oh this looks quite nice!
Re:Don't Put Tilde In Your Path by ravenical on Sunday October 11, 2026 @01:27PM (#50045581)
> hope some typescript-like "typed shell" becomes mainstream someday

Might want to check out nushell (https://www.nushell.sh/)

Re:Don't Put Tilde In Your Path by colejohnson66 on Sunday October 11, 2026 @03:08PM (#50046705)
PowerShell
Re:Don't Put Tilde In Your Path by NetMageSCW on Monday October 12, 2026 @02:43PM (#50060894)
Powershell syntax is worse than bash argument quoting and it’s half-hearted participation in .Net instead of being designed as built-in makes it annoying to do anything advanced, plus its security defaults are almost never what is wanted to actually get stuff done.
Re:Don't Put Tilde In Your Path by formerly_proven on Sunday October 11, 2026 @11:08AM (#50044113)
Array of arguments is vastly superior and more secure than every program/runtime inventing a slightly different way of splitting a command string into an array of arguments. No debate. A real problem is the related birth defect in ssh2.
Re:Don't Put Tilde In Your Path by akoboldfrying on Sunday October 11, 2026 @11:01AM (#50044025)
Well, the only other way I can think of that it could be done is the Windows way, whereby you pass the unparsed command line, spaces and all, as a string to the new process. And while this is arguably the cleaner interface, in practice it has meant even worse quote handling, since how -- or even whether -- double quotes are parsed now depends on the probably undocumented process startup code chosen by the program's compiler vendor.

Want to quote a command line that may already contain double quotes, in order to pass it as an argument to some other program? No, you don't. It isn't right to want that.

Re:Don't Put Tilde In Your Path by ChrisSD on Sunday October 11, 2026 @01:10PM (#50045396)
The other other way would be more structured. Arguments are not just an array, they also contain `--switch` and key/value pairs (e.g. `--key value` or `--key=value` depending on who you ask). One problem with the flat array approach is there's no way to distinguish a literal value starting with `-` from a switch, which means there needs to be some way to workaround that (and users have to remember the workaround; how often do people remember to use `rm -- "$FILENAME"`).

In practice almost every application does still need to do its own parameter parsing; a flat array is not enough.

Re:Don't Put Tilde In Your Path by NetMageSCW on Monday October 12, 2026 @02:39PM (#50060847)
VMS had a command description language that was used to define new commands and including allowed arguments and types.
Re:Don't Put Tilde In Your Path by NetMageSCW on Monday October 12, 2026 @02:38PM (#50060833)
Sure it is. How do you echo a command without executing it if the command is passed in?
Re:Don't Put Tilde In Your Path by account42 on Tuesday October 13, 2026 @11:36AM (#50073398)
And of course Microsoft couldn't even manage to keep their own two command-line quote parsing immplementations (Win32 and CRT) consistent.