[[ -z $(echo $c | tr -d "\015") ]] && break
The line means ..
echo $c
--> Just echo value of variable c
echo $c | tr -d "\015
--> value of variable c should if it contains special character "\015" it is something like line feed then delete it (Tr = translate )
$(echo $c | tr -d "\015")
---> Now this become a variable ... So suppose I say check if $VAR is good or I can put $(SOMETHING) then SOMETHING will be evaluated.
[[ -z $(echo $c | tr -d "\015") ]]
--> This is more like if [ SOME CONDITION ] then kind of ... shortcut .. Usually if people like to keep their job and dont want to loose to junior people ... Just kidding
--> So if you check what does -z mean from internet it says
-z = string is null, that is, has zero length
So What we have check if the result of evaluated variable is null or not ..
Now to the last part ..
[[ -z $(echo $c | tr -d "\015") ]] && break
--> && mean Anding .. Logical and .. or read in this case as THEN for if .. so it will break if condition in the if test is true ..
Now break is means break some loop and get out ... So this might be inside some loop ... Also you can have your own function here called ..
Added this
|| -> ORing if you want else part also ..
If you need more command to be excuted in then and also in OR ... you can write ..
[[ -z ... ]] && ( SOME COMMAND ) || ( SOME OTHER COMMANDS)
You can also write above as
VAR=$(echo $c | tr -d "\015")
if [ -z $VAR ];
then
break
fi
Please Note: all the above is true BASH scripting only ...