#0: If you're writing scripts that are destined for other users, use POSIX sh instead.
Can you explain why?
Things I Wish I'd Known About Bash
11–20 of 272 posts
Re: Things I Wish I'd Known About Bash
#12Re: Things I Wish I'd Known About Bash
#13Does fish-shell have an equivalent for '<()'?
Re: Things I Wish I'd Known About Bash
#14Re: Things I Wish I'd Known About Bash
#15Can someone explain :h as the article's description was not clear at all to me what was going on there.
Re: Things I Wish I'd Known About Bash
#16Earlier quoted context omitted.
Can you explain why?
For portability. bash is not available everywhere, but POSIX sh is a requirement of POSIX so you can expect it to be there.
* mac OS uses an ancient version of bash
* Embedded systems use busybox sh
* Android uses its own version of sh
* None of the BSDs come with bash, since, y'know GNU licensing
EDIT: Formatting
Re: Things I Wish I'd Known About Bash
#17 parameter result
----------- ------------------------------
$name polish.ostrich.racing.champion
${name#*.} ostrich.racing.champion
${name##*.} champion
${name%%.*} polish
${name%.*} polish.ostrich.racingRe: Things I Wish I'd Known About Bash
#18Re: Things I Wish I'd Known About Bash
#19Re: Things I Wish I'd Known About Bash
#20But, in my opinion, that's where it should stop: one shouldn't use a shell language for scripting. In scripts, it is simpler to use more verbose and clear constructs, because most editors are very powerful and provide shortcuts themselves.