From my experience? It's not really that bad if you write it from the start as POSIX shell compliant, but if you try to rewrite a large bash script it can be a nightmare. Some scripts are just easier to do with bash, but there's usually a workaround
my issue about this is that bash is the default shell in most of the distros so if you are going to install another scripting runtime then you should better write your scripts in a decent scripting language that doesn't have the context-switching mess of shell scripting and use perl, python, lua, ruby, guile, etc.
Beautiful videos man, pretty well edited, and content is pretty good as well!, I am subscribed!. Quick question, do you have any videos-tutorials on how did you tune-up your terminal and OS to look that way? everything looks so comfy and elegant! Cheers from Mexico City (:
I do have some old videos on my terminal setup, here's one for my terminal prompt: th-cam.com/video/OXKhv2rXLBo/w-d-xo.html I will make some videos on setting up bspwm and how I make my OS look like this in the future, so stay tuned!
I tried to do this thing few months back. However, I switched back to having bash as my default shell for the following reasons: 1) I run linux natively on pretty modern hardware, so there really is not much overhead provided by bash compared to dash. It may be few milliseconds faster, but for me, it's not even noticeable. 2) First point, doesn't really justify not switching because it's neither a positive nor a negative for me to change, However, I use some scripts using dmenu, which use non-posix compliant bashism or some "bloat" in form of extra flags in gnuutils which aren't recognized by dash. Took me a while to figure out some of it, learned about POSIX shell and that bashisms aren't just limited to shell but also gnuutils. Like how BSD echo is different from GNU echo and so on. ... For example, echo -e "up\down\connect" | dmenu in bash gives (using "|" as separations of the different options) up | down | connect ✅✅ in dash gives -e up | down | connect ❌❌ ... So simple thing right? just replace the -e flag with something standard... like just use
echo "up \down connect" | dmenu if you run a script having this in dash it'd produce up | down | connect ✅✅ HOWEVER, now Bash breaks it?? giving up down connect ❌❌ as one single option ... At last, I ended up switching from simple echo to printf just to pipe the output to dmenu. I saw luke smith's video on GNU is bloated and then Brodie's video on POSIX and just got to terms with using bash as my system shell. If I were handling an enterprise-grade server running linux, where security is paramount, I would switch the system shell to dash(if it already isn't) else for my personal computer where threat model is alright I would just stick to using bash. ... If you wish to check whether your script would run in dash without having to reboot your computer over and over again and checking if it breaks or not (totally not me lol) just use shellcheck --shell=dash
Great video but sadly dash was causing quite a few issues for me so won't be using it for now. Maybe in the future it'll be a viable alternative or maybe even the recommended program for a /bin/sh
@@EricMurphyxyz I was able to fix some but I'm also using zgenom and I seem to get a lot of bashisms with the plugins and the autoupdater and stuff. I could manually change them to bash but since they're coming from a git repo I'd rather not
Guess I don't have the latest version of pfetch. I should have mentioned that #!/usr/bin/env bash is more portable, that's what I use when I write bash scripts
I highly dislike both bash and dash, I prefer cash. Aside from the joke, thanks for this video ;) Cheers from France !
hatred from the uk
9:22 On the shellcheck command output, if you follow that link, it will open a page where it give code examples on how to replace arrays.
That's why I prefer using shellcheck as opposed to checkbashisms, the wiki it links to is very useful
How bad is writing POSIX-Compliant shell scripts?
From my experience? It's not really that bad if you write it from the start as POSIX shell compliant, but if you try to rewrite a large bash script it can be a nightmare. Some scripts are just easier to do with bash, but there's usually a workaround
my issue about this is that bash is the default shell in most of the distros so if you are going to install another scripting runtime then you should better write your scripts in a decent scripting language that doesn't have the context-switching mess of shell scripting and use perl, python, lua, ruby, guile, etc.
Beautiful videos man, pretty well edited, and content is pretty good as well!, I am subscribed!. Quick question, do you have any videos-tutorials on how did you tune-up your terminal and OS to look that way? everything looks so comfy and elegant!
Cheers from Mexico City (:
I do have some old videos on my terminal setup, here's one for my terminal prompt: th-cam.com/video/OXKhv2rXLBo/w-d-xo.html
I will make some videos on setting up bspwm and how I make my OS look like this in the future, so stay tuned!
@@EricMurphyxyz sounds great, I will be waiting! XD and thank you
I tried to do this thing few months back. However, I switched back to having bash as my default shell for the following reasons:
1) I run linux natively on pretty modern hardware, so there really is not much overhead provided by bash compared to dash. It may be few milliseconds faster, but for me, it's not even noticeable.
2) First point, doesn't really justify not switching because it's neither a positive nor a negative for me to change, However, I use some scripts using dmenu, which use non-posix compliant bashism or some "bloat" in form of extra flags in gnuutils which aren't recognized by dash.
Took me a while to figure out some of it, learned about POSIX shell and that bashisms aren't just limited to shell but also gnuutils. Like how BSD echo is different from GNU echo and so on.
...
For example, echo -e "up\down\connect" | dmenu
in bash gives (using "|" as separations of the different options)
up | down | connect ✅✅
in dash gives
-e up | down | connect ❌❌
...
So simple thing right? just replace the -e flag with something standard... like just use
echo "up
\down
connect" | dmenu
if you run a script having this in dash it'd produce
up | down | connect ✅✅
HOWEVER, now Bash breaks it?? giving
up
down
connect ❌❌ as one single option
...
At last, I ended up switching from simple echo to printf just to pipe the output to dmenu.
I saw luke smith's video on GNU is bloated and then Brodie's video on POSIX and just got to terms with using bash as my system shell.
If I were handling an enterprise-grade server running linux, where security is paramount, I would switch the system shell to dash(if it already isn't) else for my personal computer where threat model is alright I would just stick to using bash.
...
If you wish to check whether your script would run in dash without having to reboot your computer over and over again and checking if it breaks or not (totally not me lol) just use shellcheck --shell=dash
For a non-posix shell I'd reccomend Elvish. Had a lot of fun writing scripts with it (not a system shell though).
Great video but sadly dash was causing quite a few issues for me so won't be using it for now. Maybe in the future it'll be a viable alternative or maybe even the recommended program for a /bin/sh
What kind of issues? I'm curious
@@EricMurphyxyz I was able to fix some but I'm also using zgenom and I seem to get a lot of bashisms with the plugins and the autoupdater and stuff. I could manually change them to bash but since they're coming from a git repo I'd rather not
ubuntu is pronounced oo-boon-too, not you-bun-too
alternative title: Bash is Trash
That's a good one
I use the AUR package dashbinsh. pfetch hostname works fine for me. (pfetch-git from AUR). And my scripts use "#!/usr/bin/env bash"
Guess I don't have the latest version of pfetch. I should have mentioned that #!/usr/bin/env bash is more portable, that's what I use when I write bash scripts