Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: G Newsgroups: comp.os.linux.misc Subject: Re: Quotes in a bash script Date: 20 Oct 2022 15:36:43 GMT Organization: Lines: 44 Sender: Gip Message-ID: References: X-Trace: individual.net NBkCXe/v9GixvgDxRg2mGgr9ZBafvcISGwvDCgTBvnOXQvVZSy X-Orig-Path: not-for-mail Cancel-Lock: sha1:6xBYK0CXbRRw7zk5sNcR2aGP0BQ= User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.19.16-100.fc35.x86_64 (x86_64)) Xref: csiph.com comp.os.linux.misc:35750 Rich wrote: > G wrote: >> Hi, >> >> I have to run in a bash script a program that requires the string >> >> 'TITLE "Average"' >> >> in the command line with exactly that combination of double and >> single quotes. >> >> Whatever combinations of quotes, escapes and tricks I try the string >> passed to the program is wrong and not accepted. Is there a way to >> write that in a Bash script in a way that the prog sees exactly that? > > $ cat scr > #!/bin/bash > > echo I see: \'TITLE\ \"Average\"\' > > $ ./scr > I see: 'TITLE "Average"' Yes, I have tried that: in "echo" it works but in a script command line for some reason doesn't. If I use "set -x" to debug this is what I get ++ echo ''\''TITLE "Average"'\''' 'TITLE "Average"' ++ PROG ''\''TITLE "Average"'\''' And it gives an error, it seems that echo accept what it sees but a program gets something different or is not equipped to accept it. Even weirder the error is syntax error: 'TITLE "Average"' Which is the proper string, Probably reformatted in output or something.... I have no idea if it is possible to have as the actual command, as if I use that synatx on the comman line it works. Thanks for the help. G