[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y / ] [Home]
4chanarchives logo

pre class=prettyprint>#!/bin/bash /pre> or pre class=prettyprint>#!/bin/sh pre


Thread replies: 8
Thread images: 1

#!/bin/bash
or
#!/bin/sh
?

Which one should I use in my shell scripts and why?

And it's important or it's just a comment?
>>
'how do I greentext'
>>
fuck mate what happened to your formatting

i personally use
#!/usr/bin/env bash
or
#!/usr/bin/env sh
, depending on shell I want. bash has more features than sh and there are differences in the language.
>>
You should specify exactly what you wrote the script for. Probably bash.

sh is usually a symlink to whatever the default shell is for that OS. On some distros it's "dash" not bash, so you should specify bash in your script if that's what you're using. There are some difference between the two that can break your scripts.
>>
>>53745832
more bash/dash info
https://wiki.ubuntu.com/DashAsBinSh
>>
>>53745813
Maybe it's because here is 03:25 AM.
>>
>>53745813
This. Always use env unless you're writing a low level boot script, in which case use /bin/sh.
>>
>>53745813
>>53746762
Why should I use env if I'm always going to run the scripts from a terminal that already has all the environmental variables that I want set?

Not being facetious, genuinely interested if this is useful.
Thread replies: 8
Thread images: 1
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y / ] [Home]

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
If a post contains illegal content, please click on its [Report] button and follow the instructions.
This is a 4chan archive - all of the content originated from them. If you need information for a Poster - you need to contact them.
This website shows only archived content and is not affiliated with 4chan in any way.
If you like this website please support us by donating with Bitcoin at 1XVgDnu36zCj97gLdeSwHMdiJaBkqhtMK