this post was submitted on 02 Nov 2023
30 points (96.9% liked)
Linux
48372 readers
994 users here now
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
ash
(and its successordash
found on other distros) is a POSIX-y shell rather than ash
clone, so it has all(? most?) of the POSIX feature set, whose syntax may indeed have been 'borrowed' from shells that came later thansh
.Not sure if there's a "parent" from which both
ash
andbash
inherit the syntax or whetherbash
is the true source, but that doesn't really matter here.All that said, it's worth checking to see if your system has a command on the PATH called
[[
. That has been one way that[[
support can be added to a system when the shell itself might not support it. Note that command names don't have to be alphanumeric like functions tend to be in a programming language (or other languages if you consider that the shell can be used for programming too), so[[
is perfectly valid!Yup, that looks like exactly what was done in Alpine:
So while the Ash itself doesn't support the
[[
extension, this work-around produces the same effect. Nifty.Although that link exists, that's not what is being used by default.
[[
is a shell builtin in ash/busybox, so that takes precedence.On Alpine:
Huh. So the link is unnecessary and Ash supports [[ out of the box? Good to know, thanks!