Reputation: 1
I have the following with &&
and ||
. Because I want to have lines within 80 characters, how can I split this on different lines? Does always need continuation character \
?
(( cval != 1 )) && echo "$k" || { echo "" ; printf '%s\n' "${desc[@]}" ; }
Upvotes: 0
Views: 100
Reputation: 140990
how can I split this on different lines?
So just literally put newlines after &&
and ||
and after {
and instead of or after ;
. You can also put comments on separate lines, if you want to.
(( cval != 1 )) &&
echo "$k" ||
{
echo ""
printf '%s\n' "${desc[@]}"
}
But really, && ||
are confusing. Strongly consider an if. And echo ""
- just echo
.
if (( cval != 1 )); then
echo "$k"
else
echo
printf '%s\n' "${desc[@]}"
fi
Upvotes: 3