BlackEco@lemmy.blackeco.com to Programming@programming.devEnglish · 2 days agoError handling in bashnotifox.comexternal-linkmessage-square29linkfedilinkarrow-up1105arrow-down11
arrow-up1104arrow-down1external-linkError handling in bashnotifox.comBlackEco@lemmy.blackeco.com to Programming@programming.devEnglish · 2 days agomessage-square29linkfedilink
minus-squareMonkderVierte@lemmy.ziplinkfedilinkarrow-up3·edit-210 hours 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 hours agoUhm, yes. I noted exactly that as well. Also bash is not always at /bin/bash :-)
minus-squareMonkderVierte@lemmy.ziplinkfedilinkarrow-up1·edit-22 hours agoYeah ok, /usr/bin/env then. Edit: Or /bin/sh (oold convention) and check for bash.
minus-squarecr1cket@sopuli.xyzlinkfedilinkarrow-up3·2 hours 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.