3 ms·
The author uses OpenBSD which uses ksh as their default shell. I just ran ksh on Arch Linux and even though `touch foo:bar` worked, when I did tab-completion th
by craftkiller 5y ago
The author uses OpenBSD which uses ksh as their default shell. I just ran ksh on Arch Linux and even though `touch foo:bar` worked, when I did tab-completion the shell escaped the colon anyway, making my command `touch foo\:bar`. I assume its related to this, but I've never used ksh before so I can't explain the difference in the tab-completion behavior.
- Arnavion 5y agobash is the same - `:` isn't special but tab-completion escapes it. Tab-completion is probably being conservative about escaping it in case you're using it as a path separator, like when setting a `$PATH`-like var.
- dsl 5y agoThe shell doesn't know what the underlying filesystem is. : is special on NTFS for alternative data streams, and I think HFS+ named forks? (The mac syntax is foo/..namedfork/rsrc, I don't know how that translates to linux) "foo\:bar" is a file name with a colon in it. "foo:bar" is an ADS named bar on the file foo.
- Arnavion 5y agoMaybe. The motivation may have been lost to history. bash added `:` to the list of completion word break characters with bash 2.0 [1][2]. Bash 2.0 was released in 1996. NTFS-3G started in 2006 but it was "forked from the Linux-NTFS", and I can't find any history for this project. NTFS itself was released in 1993. HFS+ seems to have been released in 1998, so it can't be the reason. But even regular HFS had resource forks and it was released in 1985. No idea where to look in ksh's source. [1]: https://github.com/bminor/bash/commit/ccc6cda312fea9f0468ee65b8f368e9653e1380b#diff-b8fb328cf74196c51b622571b2c765c857d4c5e766b0ce4b550f77280892e64eL239 https://github.com/bminor/bash/commit/ccc6cda312fea9f0468ee6... [2]: https://github.com/bminor/bash/commit/ccc6cda312fea9f0468ee65b8f368e9653e1380b#diff-b8fb328cf74196c51b622571b2c765c857d4c5e766b0ce4b550f77280892e64eR129 https://github.com/bminor/bash/commit/ccc6cda312fea9f0468ee6...
- teddyh 5y ago> "foo\:bar" is a file name with a colon in it. "foo:bar" is an ADS named bar on the file foo. That does not make sense. The shell does not itself know anything about ADSs, and therefore, in both cases, sends the string "foo:bar" as arguments to commands.