Re: Bash question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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.
<snip>
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
interpreted.

     mark


_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos



[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]


  Powered by Linux