I got a shell script and inside I got the command as below

sh ../jboss/bin/standalone.sh --server-config=standalone-full.xml -Djboss.node.name=node1 -b -bmanagement

How can I break the line to multiple lines for better understanding and management

sh ../jboss/bin/standalone.sh 

Tried with backslash at the end of each line and it doesnt work.


2 Answers 2


This is known as continuation, and uses \ as the very last character on each line apart from the last one:

sh ../jboss/bin/standalone.sh         \
  --server-config=standalone-full.xml \
  -Djboss.node.name=node1             \
  -b                          \

(aligned for cosmetic purposes, they don’t have to be).

For more on this, see Shell Syntax: How to correctly use \ to break lines? and the linked questions.

  • \ as the very last character on each line this is very important, avoid space chars after the \
    – nulll
    May 5 at 8:54

Working on the idea from Paul_Pedant's comment, in Bash/ksh/zsh you could use an array:

sh ../jboss/bin/standalone.sh "${args[@]}"

Here, the parenthesis provide the syntactic clue the shell needs to know when the array assignment ends. Sadly, this only works with an array assignment, not with just the single command.

Also, if the jboss script is properly set with execute permissions and a hashbang in the script, you should be able to run it as just ../standalone.sh, without the explicit sh in front.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .