Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.misc > #35750

Re: Quotes in a bash script

From G <g@nowhere.invalid>
Newsgroups comp.os.linux.misc
Subject Re: Quotes in a bash script
Date 2022-10-20 15:36 +0000
Organization <Not Here, Not Me>
Message-ID <jrd88bFak8lU1@mid.individual.net> (permalink)
References <jrcjpgF7igtU1@mid.individual.net> <tirebs$b183$1@dont-email.me>

Show all headers | View raw


Rich <rich@example.invalid> wrote:
> G <g@nowhere.invalid> 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 <PROG  'TITLE "Average"'> as the
actual command, as if I use that synatx on the comman line it works.

Thanks for the help.

G 

Back to comp.os.linux.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Quotes in a bash script G <g@nowhere.invalid> - 2022-10-20 09:47 +0000
  Re: Quotes in a bash script Rich <rich@example.invalid> - 2022-10-20 12:19 +0000
    Re: Quotes in a bash script G <g@nowhere.invalid> - 2022-10-20 15:36 +0000
      Re: Quotes in a bash script Rich <rich@example.invalid> - 2022-10-20 16:06 +0000
      Re: Quotes in a bash script Joe Beanfish <joebeanfish@nospam.duh> - 2022-10-20 16:11 +0000
        Re: Quotes in a bash script G <g@nowhere.invalid> - 2022-10-20 17:08 +0000
          Re: Quotes in a bash script Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2022-10-20 20:19 +0000
            Re: Quotes in a bash script G <g@nowhere.invalid> - 2022-10-21 09:47 +0000
              Re: Quotes in a bash script "26C.Z969" <26C.Z969@noaada.net> - 2022-11-23 00:00 -0500
  Re: Quotes in a bash script Dominik Ałaszewski <Dominik.Alaszewski@gazeta.pl.invalid> - 2022-10-21 11:12 +0000

csiph-web