Re: Bash question

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



On 06/07/2018 15:18, Jerry Geis wrote:

> MSG="file 2"
> MSG="csv \"$MSG\""
> echo $MSG
> /opt/libreoffice5.4/program/soffice.bin --headless --convert-to $MSG

This is a really convoluted way of doing things, and you'd have to be a
super expert in quoting to get this right. Instead, why don't you just
have 2 variables, and pass them both, eg:

MSG=csv
FILENAME="my file with spaces"
/path/to/soffice.bin --headless --convert-to "$MSG" "$FILENAME"

Remember to quote both variables, so that if they have any spaces, the
spaces are not accidentally seen as parameter separators, and instead
get passed to the soffice.bin program.

Regards,
Anand
_______________________________________________
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