简体   繁体   中英

command with multiple argument on shell script

I am working with the graphing tool xmgrace and I am trying to plot multiple datasets. Rewriting the command with all the arguments over and over is becoming a waste of time, so I decided to make a shell script called xmgraceScript.

At the moment my shell script looks like this:

xmgrace dirA/argA dirB/argB dirC/argC

since the dir paths are pretty long I would like to have each argument in a new line, just to make the script more readable. I tried to do this by writing:

xmgrace << _XMARGS_
dirA/argA
dirB/argB
dirC/argC
_XMARGS_

this does not work. Can anyone recommend a different way of doing so?

thank you

Simply end all lines other than the last with a backslash character:

xmgrace \
    dirA/argA \
    dirB/argB \
    dirC/argC

(The '<<' construct feeds the enclosed content to the standard input of the command.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM