I would like to embed a long command like this in a bash script:
mycommand \\
--server myserver \\
--filename extremely/long/file/name/that/i/would/like/
It's a bit of a hack, but this works:
mycommand \
--server myserver \
--filename "extremely/long/file/name/"`
`"that/i/would/like/to/be/able/to/break/"`
`"up/if/possible" \
--otherflag \
--anotherflag
Bash concatenates string literals that are adjacent, so we take advantage of that. For example, echo "hi" "there"
prints hi there
whereas echo "hi""there"
prints hithere
.
It also takes advantage of the backtick operator, and the fact that a bunch of spaces evaluates to nothing.