[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: mule.png (1.37 MB, 1536x1024)
1.37 MB PNG
#!/bin/bash should be a war crime
>>
>>108642694
#!/usr/bin/env -S bash -euo pipefail
>>
>>108642694
It is a crime.

We had a guy that littered his stuff with bashisms on his local test machine and on production the /bin/sh wasn’t bash so he copied the bash binary over top of /bin/sh to “fix” all his bugs.
>>
>>108642714
lmao at least force posix mode
>>
>>108642694
This meme is so perplexing. The speech bubble was moved from Noah to the Elephant and it's looking at it's own mongrel baby? Lexer + Parser = Bash?
>>
>>108642714
>he copied the bash binary over top of /bin/sh to “fix” all his bugs.
Well, if it works...
>>
>>108642714
zero reason for the shell to not be bash
>>
>>108642714
kek based bash zealot
>>
>>108643191
if you call /bin/sh on most Debian distros it'll be dash which only implements POSIX mode when called as sh, unlike bash which still allows bashisms.
>>
>>108643300
Okay but it's also not bash's fault that this guy is an astronomical retard who doesn't know how shebangs work
>>
>>108642694
Why the fuck the elephant are the one asking question?
>>
>>108642694
? I love bash
>>
>>108642714
>he copied the bash binary over top of /bin/sh
unfathomably based
>>
>>108643191
go back to windows/macos
>>
>>108642714
>he copied the bash binary over top of /bin/sh to “fix” all his bugs.
Wtf? Why not just include bash on the system and use the shebang as the OP has, that's literally what it's for
t. likes bashisms over pure shisms
>>
>>108642694
banging bash
talking one line slaughter
>>
>>108644665
Nobody cares what you like. This is why we have env.
>>
>>108642960
It stopped working on all the production machines when there was a regular patch/update.
In the middle of the night.
This was also after all the senior devs took hours explaining the difference between bash and sh because he had the problems on his own machine.
Guy was buddies with the CEO and was made senior, and everyone else demoted to Jr. We all quit.
Whole company died off due to other shenanigans, and the guys are blacklisted vendors now.
>>
>>108642694
True.

>If a language poses difficulties to parsers, it surely also poses difficulties for the human reader.
>— Niklaus Wirth
>>
>>108642694
bash has a lexer and parser?
>>
>>108642714
Should've been one line change if you nigs were using docker.
>>
>>108644909
Bash is both the lexer and parser (except to my knowledge it doesn't lex at all)
>>
>>108644854
sh is a recursive descent parser.
It’s still a parser even if it doesn’t use yacc.

> Wirth quote
Good quote to the extent that everybody in the world programs in Oberon-07.
>>
talk shit about something and dont elaborate, thats the OP
>>
>>108645642
>muh popular = better
>>
File: debian_disk.png (34 KB, 602x500)
34 KB PNG
>>108642714
Reminder that shebangs are a kernel feature, not a bashism. Should work regardless of shell.
>>
>>108642714
What the fuck lmao
>>
>>108642714
real psychopassoid
>>
I usually code in bash for the comfy, then afterwards go over everything just to see if the bashisms can be easily converted to pure sh (e.g., just syntax sugar, not anything I'd need to redo the logic like arrays or shit) and if I can, I just port it back to pure sh. Seems like the best of both worlds.
>>
>>108642714
senior engineer here
what's the difference between bash and shell?
>>
>>108648092
mostly it's that bash has more features
it's still miserably awkward to do high-quality scripts, and yet it's better than so many alternatives
>>
No, that's fine. The real crime is #/bin/sh, but it's not actually a POSIX sh script.
>>
>>108642708
>-S
Fuck, I needed that the other day and in my retared half awake state I didn't think to RTFM.
>>
babys first shell scripts are allways bash dependant its just how it is its your job to tewrite it in rust
>>
>>108644909
I don't really know what the OP image gets at, but the stages of processing and evluation in Bash aren't that straightforward. Fun little demonstration:
 my_array=("echo" "value: $my_var")
${my_array[@]}
my_array=("my_var=10" "echo" "value: $my_var")
${my_array[@]}
>>
>>108644790
he was right and you guys are all faggots
he knew what he was doing: true unix philosophy, google standard /bin/sh -> bash
instead of helping them make it not break on updates, you formed a gay jewish cabal
>>
>>108643300
POSIX is designed by committee garbage, which makes dash garbage.
What you actually should do is target Linux+BSD portability, and use a "bashism subset" that is compatible with ksh of BSD.
>>
>>108648092
if you run a bash script via traditional unix /bin/sh it will not run
just like you cannot use /usr/bin/perl to run .py scripts
>>
>>108651589
bash was never part of unix
>>108651617
neither does ksh
what you should do is making your shell compatible with the original sh from unix



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.