Inside [[ ]] I do not need to quote variables right?
Rather than
if [[ "$flrm" == *"org"* || "$flrm" == "all" ]]; then
printf '%s\n' "Delete: $fl"
fi
I can do
if [[ $flrm == *"org"* || $flrm == "all" ]]; then
printf '%s\n' "Delete: $fl"
fi
Inside [[ ]] I do not need to quote variables right?
Rather than
if [[ "$flrm" == *"org"* || "$flrm" == "all" ]]; then
printf '%s\n' "Delete: $fl"
fi
I can do
if [[ $flrm == *"org"* || $flrm == "all" ]]; then
printf '%s\n' "Delete: $fl"
fi
=,==,!=, or=~. – Vera Oct 21 '21 at 07:54[[prevents word splitting of variable values, contrary to['. – Vera Oct 21 '21 at 08:02[ ], I have seen people usingif [ $var = "test" ]andif [ $var == "test" ]. I do not think there is a difference, or am I wrong? – Vera Oct 21 '21 at 08:08[[ … ]]support both=and==, so neither it more correct than the other. Ksh documents=as deprecated. Mksh documents==as deprecated. Bash and zsh recommend them equally (when inside double brackets). However, inside single brackets or aftertest,=is preferable because most shells that don't support double brackets, and standalonetestimplementations, only recognize=. – Gilles 'SO- stop being evil' Oct 21 '21 at 09:09