BlackEco@lemmy.blackeco.com to Programming@programming.devEnglish · 3 days agoError handling in bashnotifox.comexternal-linkmessage-square29fedilinkarrow-up1107arrow-down11
arrow-up1106arrow-down1external-linkError handling in bashnotifox.comBlackEco@lemmy.blackeco.com to Programming@programming.devEnglish · 3 days agomessage-square29fedilink
minus-squareMonkderVierte@lemmy.ziplinkfedilinkarrow-up4·edit-22 days ago Do you need POSIX compability? If not, use bash-isms without shame But call it a bash script then! Remember: #!/bin/sh is run by all kinds of shells; consider them POSIX. Bash is #!/bin/bash.
minus-squarecr1cket@sopuli.xyzlinkfedilinkarrow-up2·2 days agoUhm, yes. I noted exactly that as well. Also bash is not always at /bin/bash :-)
minus-squareMonkderVierte@lemmy.ziplinkfedilinkarrow-up2·edit-22 days agoYeah ok, /usr/bin/env then. Edit: Or /bin/sh (oold convention) and check for bash.
minus-squarecr1cket@sopuli.xyzlinkfedilinkarrow-up3·2 days agoWell, that won’t work on openbsd (and probably freebsd), because non-default.stuff lands in /usr/local/bin. For Linux you should be fine though.
But call it a bash script then! Remember:
#!/bin/shis run by all kinds of shells; consider them POSIX. Bash is#!/bin/bash.Uhm, yes. I noted exactly that as well.
Also bash is not always at /bin/bash :-)
Yeah ok, /usr/bin/env then.
Edit: Or /bin/sh (oold convention) and check for bash.
Well, that won’t work on openbsd (and probably freebsd), because non-default.stuff lands in /usr/local/bin.
For Linux you should be fine though.