Is there a way to continue a command on a new line? My MsgBox()
function call is long, for the sake of readability I want to do something like this:
$confirm = MsgBox(321, "Check Information", "Confirmation Number: " & @LF &
"Amount: $")
This returns a syntax error and points to the end of the first line as being the location of the error.
Continuing a Long Command on Another Line To make the commands easier to understand, use the shell escape character, which is a backslash, to continue a command on the next line.
If you want to break up a command so that it fits on more than one line, use a backslash (\) as the last character on the line. Bash will print the continuation prompt, usually a >, to indicate that this is a continuation of the previous line.
From the bash manual: The backslash character '\' may be used to remove any special meaning for the next character read and for line continuation.
The most used newline character If you don't want to use echo repeatedly to create new lines in your shell script, then you can use the \n character. The \n is a newline character for Unix-based systems; it helps to push the commands that come after it onto a new line.
Place an underscore at the end of the line:
$confirm = msgbox(321, "Check Information", "Confirmation Number: " & @LF & _
"Amount: $")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With