I have a function in a script that returns an exit code of 0 if a given line number exists in a file, otherwise it returns an exit code of 1. This is its current structure:
lineCont=$(sed "$1!d" "$dbFile")
if [ -z "$lineCont" ]; then
return 1
fi
If I try to replace the if-statement with [ -z "$lineCont" ] && return 1
it will return an exit code of 1 even if the line actually exists in the file. Why this happens?
Aucun commentaire:
Enregistrer un commentaire