[CentOS] Bash question

Anand Buddhdev anandb at ripe.net
Fri Jul 6 14:34:03 UTC 2018

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:

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.


More information about the CentOS mailing list