I was wondering if it is proper in Bash to, say, print a possibly unassigned string:
if [[ test ]]; then
str="foo"
fi
printf "foo or empty: %s" "$str"
Or do I have to assign a default value outside of the if-statement like str=""
I don't get any errors so it seems to be fine.