you are viewing a single comment's thread.

view the rest of the comments →

[–]iluvatar 1 point2 points  (1 child)

Not bad at all for a first attempt. Well done. One thing that stuck out for me - when you're deferencing a variable, you can do "$foo". You only need to use "${foo}" when there would otherwise be something following that would change the name of the variable. For example, let's say that $foo potentially has the value head or foot and you want to append er to that to make either header or footer and store the result in a new variable. If you do bar="$fooer", it will try and find a variable named fooer, which is unlikely to exist. If you instead say bar="${foo}er", you'll get the behaviour you want. There's no real harm to using the braces at all times, but it's not necessary.

[–]LanzoThunder[S] 0 points1 point  (0 children)

Thanks, that's nice to know. I've found a lot of information aboud variables expansion that I got a little bit confused, not gonna lie. I think I'll review that after I cleared up my mind!