简体   繁体   中英

How do I escape spaces in bash environment variables as an argument?

I have an environment variable that contains flags and arguments eg

export CMD='compile -m bla --vars "hello there"'

When I try to run run ${CMD} , the error says:

error: unrecognized arguments: there"

It doesn't register that the quotation belongs to "hello there". How can I escape this?

Can try to use backtick. A backtick is not a quotation sign. It has a very special meaning. Everything you type between backticks is evaluated (executed). Attection is executed before the main command

hope it helps you in your problem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM