[CentOS] Bash question
Pete Biggs
pete at biggs.org.uk
Fri Jul 6 14:32:09 UTC 2018
> I am trying to make a variable containing spaces which is MSG. Then add to
> that variable the argument csv. The "echo" above prints the write stuff.
> But when I try to use it in the last command its no longer valid and says
> Source file could not be loaded.
>
> What am I missing? much searching hinted to arrays and using \$ but I
> could not get that to work.
>
Using arrays to build the command is useful because the arguments are
absolutely defined in each element of the array - i.e. the arguments to
the exec call are correctly built.
I think the simplest way of doing what you want on a command line is to
use two separate variables:
MSG1="file 2"
MSG2="csv"
/opt/libreoffice5.4/program/soffice.bin --headless --convert-to $MSG2 "$MSG1"
P.
More information about the CentOS
mailing list