[CentOS] Bash question

Fri Jul 6 13:59:10 UTC 2018
mark <m.roth at 5-cent.us>

Jerry Geis wrote:
> Hi All,
> I am trying to build a command line with spaces in the argument. This
> demonstrates what I am trying to do. Clearly the first two commands work
> fine. However, the last 4 lines to not.
> /opt/libreoffice5.4/program/soffice.bin --headless --convert-to csv
> "/tmp/file.xlsx"
> /opt/libreoffice5.4/program/soffice.bin --headless --convert-to csv
> "/tmp/file 2.xlsx"
> MSG="file 2"
> MSG="csv \"$MSG\""
> echo $MSG /opt/libreoffice5.4/program/soffice.bin --headless --convert-to
> $MSG
> 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.
I think the second MSG= effectively overwrites the first assignment. Why
not use FIL="file 2";MSG="csv $FIL"? Note, also, you don't need quotes or
backslash escapes - as long as you use quotes, not apostrophes, it will be