I have a very long bash command inside a command substitution like following:
$( comaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaand )
I want to know if there is a way to break this command into shorter lines for the sake of readability like following:
$( com
aaaaaaaaaaaaaa
aaaaaaaaaaaaaa
nd )
\
part is correct, but you can not indent the subsequent lines. (At least not in the middle of words as in the example.) – manatwork Jul 08 '13 at 08:46commaaaaaaaaaaaaaand
is actuallycommand with a lot of options and | maybe pipes etc
. Otherwise it doesn't work with indentation.Tryecho $(ec\<NEWLINEHERE>ho a)
, works whileecho $(ec\<NEWLINE HERE><INDENTATION HERE>ho a)
produce ec: command not found. Whileecho $(echo Hello,\<NEWLINE HERE> World)
[note the space after newline] andecho $(echo Hello,<NEWLINE HERE><INDENTATION HERE> World)
do exactly the same things. – Bakuriu Jul 08 '13 at 13:28echo "$(echo "Hello,\<NEWLINE HERE> World")"
) so the outer echo receives several parameters and separate them with only 1 default separator. – Olivier Dulac Jul 09 '13 at 09:14\<NEWLINE><indentation>something
is equivalent to\<NEWLINE><anotherindentation>something
", which is false in general and only true when the newline and indentation are just (unnacounted for) separators. – Olivier Dulac Jul 09 '13 at 13:23