What are the contras for writing bash scripts like in the example below? Would you separate a variable assignment or a function call from the check of its return code? If so, why? What is wrong - if anything - with this kind of conditionals?
local return_code=0
if username=$(get_username "${user}") \
&& is_from_earth "${user}"; then
echo "${username} is an earthling"
else
echo "ERROR: no name or not from the Earth"
return_code=1
fi
Aucun commentaire:
Enregistrer un commentaire