I am trying to understand following pice of code:
for f in *.out; do sort -cg <$f &>/dev/null && res="sorted" || res="unsorted"; echo "File $f is $res."; done
For loop iterates through all .out
files and gives each one as a parameter to sort
, and the output of the sort is redirected into "nothing". But can someone explain what: && res="sorted" || res="unsorted"
does?