#bashism — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #bashism, aggregated by home.social.
-
@dmbaturin @jessebot
I once received a shell script to add to our stack from a third party developer for the purpose of an integration project. I pointed out a #bashism (we were running busybox sh with partial bash compatibility). I then received an updated patch that only changed the shebang from #!/bin/sh to #!/bin/bash . So I had to explain again. -
@davetron5000 BTW, the code I posted before had errors. Here's a one-liner that actually works with #Docker and #AlpineLinux.
```bash
docker run --privileged -i --rm alpine:latest \
<<< 'apk update && apk add usbutils && lsusb -t && exit'
```The redirection operator is a #bashism that won't work as-is in #Bourne or #FishShell. However, I validated that it works as intended under Bash, and thus probably under #Z-Shell. Hope it's useful to you, or to anyone running #TrueNAS Scale.
-
@davetron5000 BTW, the code I posted before had errors. Here's a one-liner that actually works with #Docker and #AlpineLinux.
```bash
docker run --privileged -i --rm alpine:latest \
<<< 'apk update && apk add usbutils && lsusb -t && exit'
```The redirection operator is a #bashism that won't work as-is in #Bourne or #FishShell. However, I validated that it works as intended under Bash, and thus probably under #Z-Shell. Hope it's useful to you, or to anyone running #TrueNAS Scale.
-
i feel silly i didnt know this #bashism already. take a ; delimited list and loop on it's values
DATA="this=that;is=isnt;a=b;list=ok"
D=""
for opt in ${DATA//;/ }; do
D="${D} -d ${opt}"
done
curl -x POST "$D" api/search -
i feel silly i didnt know this #bashism already. take a ; delimited list and loop on it's values
DATA="this=that;is=isnt;a=b;list=ok"
D=""
for opt in ${DATA//;/ }; do
D="${D} -d ${opt}"
done
curl -x POST "$D" api/search -
-
-
“source” is a #bashism. The actual #POSIX name of the command is “.”. That’s right, a single dot.
Many people expect . to be some kind of a shortcut for “source”, and yes, they’re equivalent in #bash, but “source” is not guaranteed to exist in other shells. dash doesn’t have it, for example.
So, if you want to write your shell scripts as compatible as possible, use “.”, not “source”.
-
“source” is a #bashism. The actual #POSIX name of the command is “.”. That’s right, a single dot.
Many people expect . to be some kind of a shortcut for “source”, and yes, they’re equivalent in #bash, but “source” is not guaranteed to exist in other shells. dash doesn’t have it, for example.
So, if you want to write your shell scripts as compatible as possible, use “.”, not “source”.
-
@konst Since you’re saying “etc.”, I feel compelled to mention that `<<<` works in bash, but is not in POSIX and will therefore for example not work in #!/bin/sh scripts in Debian. See https://mywiki.wooledge.org/Bashism
-
@konst Since you’re saying “etc.”, I feel compelled to mention that `<<<` works in bash, but is not in POSIX and will therefore for example not work in #!/bin/sh scripts in Debian. See https://mywiki.wooledge.org/Bashism
-
-
-
@xarvos @Haydar I used FreeBSD for a few months, but went back to Linux. The reasons were, that I had to rewrite all my scripts ( #bashism ) and a lot of stuff just didn't work. Even if it's a good system, the bigger community is on the Linux site and more software is available for Linux. Many git repos I checked out wouldn't work on *BSD, but on Linux.
-
@Fritange I used FreeBSD for several months and got other problems, I didn't see coming.
I published a lot of scripts, many are written in bash and that's what doesn't exist directly in the BSD world. I had to rewrite most of them, because the *BSD community told me I have a decease called #bashism and rewriting scripts to make them usable for Linux AND *BSD makes them bloaty.
-