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


Groups > linux.debian.user > #227190

Re: weird behaviour of quotes in dash variable assignments

From Gary Dale <gary@extremeground.com>
Newsgroups linux.debian.user
Subject Re: weird behaviour of quotes in dash variable assignments
Date 2020-09-21 06:00 +0200
Message-ID <ARl9D-80D-1@gated-at.bofh.it> (permalink)
References <ARfGW-4R8-13@gated-at.bofh.it> <ARfQC-4Ue-5@gated-at.bofh.it> <ARi25-67g-1@gated-at.bofh.it> <ARiEN-6yK-1@gated-at.bofh.it> <ARkdA-7rB-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 2020-09-20 22:55, David Christensen wrote:
> On 2020-09-20 18:18, Gary Dale wrote:
>> On 2020-09-20 20:36, David Christensen wrote:
>
>> The environments are identical.
>
>>> Have you tried '#!/bin/sh' ?
>>
>> That's my shebang line.
>
>>> Have you tried single quotes?
>>
>> Wouldn't want to. Single quotes alter the behaviour.
>
> Double quotes, single quotes, and no quotes have the same behavior on 
> my machine:
>
> 2020-09-20 19:50:55 dpchrist@tinkywinky ~/sandbox/sh
> $ cat debian-user-20200920-1727-gary-dale.sh
> #!/bin/sh
>
> doublequote="/root/clamscan-report"
> echo $doublequote
>
> singlequote='/root/clamscan-report'
> echo $singlequote
>
> noquote='/root/clamscan-report'
> echo $noquote
>
> 2020-09-20 19:53:02 dpchrist@tinkywinky ~/sandbox/sh
> $ /bin/sh -x debian-user-20200920-1727-gary-dale.sh
> + doublequote=/root/clamscan-report
> + echo /root/clamscan-report
> /root/clamscan-report
> + singlequote=/root/clamscan-report
> + echo /root/clamscan-report
> /root/clamscan-report
> + noquote=/root/clamscan-report
> + echo /root/clamscan-report
> /root/clamscan-report
>
>
> Please run the above script and the following commands, and post your 
> console session -- prompts, commands, output:
>
> 2020-09-20 19:52:29 dpchrist@tinkywinky ~/sandbox/sh
> $ cat /etc/debian_version
> 9.13
>
> 2020-09-20 19:52:38 dpchrist@tinkywinky ~/sandbox/sh
> $ uname -a
> Linux tinkywinky 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) 
> x86_64 GNU/Linux
>
> 2020-09-20 19:52:43 dpchrist@tinkywinky ~/sandbox/sh
> $ dpkg-query --show dash
> dash    0.5.8-2.4
>
> 2020-09-20 19:52:51 dpchrist@tinkywinky ~/sandbox/sh
> $ dpkg --verify dash
>
> 2020-09-20 19:52:56 dpchrist@tinkywinky ~/sandbox/sh
> $ sha256sum /bin/sh
> e803088e7938b328b0511957dcd0dd7b5600ec1940010c64dbd3814e3d75495f /bin/sh
>
>
> David
>
In the simple case, the quotes are the same, but there are times when 
they have different behaviours. I avoid single-quotes so that when I use 
them, it's a clue that there is a reason.

Here's what I got with your script:

/root/clamscan-report
/root/clamscan-report
/root/clamscan-report

When I retried my script with the quotes, it started working. I have no 
idea what changed from earlier today. I certainly didn't update anything 
on either server...

Back to linux.debian.user | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

weird behaviour of quotes in bash variable assignments Gary Dale <gary@extremeground.com> - 2020-09-21 00:10 +0200
  Re: weird behaviour of quotes in bash variable assignments The Wanderer <wanderer@fastmail.fm> - 2020-09-21 00:20 +0200
    Re: weird behaviour of quotes in bash variable assignments David Christensen <dpchrist@holgerdanske.com> - 2020-09-21 02:40 +0200
      Re: weird behaviour of quotes in dash variable assignments Gary Dale <gary@extremeground.com> - 2020-09-21 03:20 +0200
        Re: weird behaviour of quotes in dash variable assignments David Christensen <dpchrist@holgerdanske.com> - 2020-09-21 05:00 +0200
          Re: weird behaviour of quotes in dash variable assignments Gary Dale <gary@extremeground.com> - 2020-09-21 06:00 +0200
            Re: weird behaviour of quotes in dash variable assignments David Christensen <dpchrist@holgerdanske.com> - 2020-09-21 06:20 +0200
        Re: weird behaviour of quotes in dash variable assignments David <bouncingcats@gmail.com> - 2020-09-21 05:40 +0200
          Re: weird behaviour of quotes in dash variable assignments David Christensen <dpchrist@holgerdanske.com> - 2020-09-21 06:10 +0200
            Re: weird behaviour of quotes in dash variable assignments Cindy Sue Causey <butterflybytes@gmail.com> - 2020-09-21 14:00 +0200
              Re: weird behaviour of quotes in dash variable assignments Greg Wooledge <wooledg@eeg.ccf.org> - 2020-09-21 14:20 +0200
                Re: weird behaviour of quotes in dash variable assignments David Wright <deblis@lionunicorn.co.uk> - 2020-09-21 16:40 +0200
                Re: weird behaviour of quotes in dash variable assignments Gary Dale <gary@extremeground.com> - 2020-09-22 03:00 +0200
                Re: weird behaviour of quotes in dash variable assignments David Wright <deblis@lionunicorn.co.uk> - 2020-09-22 15:40 +0200
                Re: weird behaviour of quotes in dash variable assignments Gary Dale <gary@extremeground.com> - 2020-09-22 19:40 +0200
                Re: weird behaviour of quotes in dash variable assignments David Wright <deblis@lionunicorn.co.uk> - 2020-09-23 17:50 +0200
                Re: weird behaviour of quotes in dash variable assignments Gary Dale <gary@extremeground.com> - 2020-09-21 18:40 +0200
                Re: weird behaviour of quotes in dash variable assignments Greg Wooledge <wooledg@eeg.ccf.org> - 2020-09-21 18:50 +0200
                Re: weird behaviour of quotes in dash variable assignments Gary Dale <gary@extremeground.com> - 2020-09-21 19:00 +0200
                Re: weird behaviour of quotes in dash variable assignments Greg Wooledge <wooledg@eeg.ccf.org> - 2020-09-21 19:20 +0200
                Re: weird behaviour of quotes in dash variable assignments Gary Dale <gary@extremeground.com> - 2020-09-21 20:50 +0200
                Re: weird behaviour of quotes in dash variable assignments David Wright <deblis@lionunicorn.co.uk> - 2020-09-22 02:40 +0200
                Re: weird behaviour of quotes in dash variable assignments David Christensen <dpchrist@holgerdanske.com> - 2020-09-21 22:20 +0200
                Re: weird behaviour of quotes in dash variable assignments Gary Dale <gary@extremeground.com> - 2020-09-22 03:10 +0200
                Re: weird behaviour of quotes in dash variable assignments David Christensen <dpchrist@holgerdanske.com> - 2020-09-22 06:30 +0200
                Re: weird behaviour of quotes in dash variable assignments Gary Dale <gary@extremeground.com> - 2020-09-22 22:10 +0200
                SSH agent forwarding (was: weird behaviour of quotes in dash variable  assignments) David Christensen <dpchrist@holgerdanske.com> - 2020-09-23 00:40 +0200
        Re: weird behaviour of quotes in dash variable assignments Greg Wooledge <wooledg@eeg.ccf.org> - 2020-09-21 14:00 +0200
          Re: weird behaviour of quotes in dash variable assignments Gary Dale <gary@extremeground.com> - 2020-09-21 18:40 +0200
    Re: weird behaviour of quotes in bash variable assignments Gary Dale <gary@extremeground.com> - 2020-09-21 03:10 +0200
  Re: weird behaviour of quotes in bash variable assignments <tomas@tuxteam.de> - 2020-09-21 10:00 +0200
    Re: weird behaviour of quotes in bash variable assignments David Christensen <dpchrist@holgerdanske.com> - 2020-09-21 22:20 +0200
      Re: weird behaviour of quotes in bash variable assignments Greg Wooledge <wooledg@eeg.ccf.org> - 2020-09-21 22:30 +0200
        Re: weird behaviour of quotes in bash variable assignments Gary Dale <gary@extremeground.com> - 2020-09-21 23:30 +0200
          Re: weird behaviour of quotes in bash variable assignments Andrei POPESCU <andreimpopescu@gmail.com> - 2020-09-22 07:50 +0200
            Re: weird behaviour of quotes in bash variable assignments Gary Dale <gary@extremeground.com> - 2020-09-22 22:40 +0200
              Re: weird behaviour of quotes in bash variable assignments Greg Wooledge <wooledg@eeg.ccf.org> - 2020-09-22 23:00 +0200
              Re: weird behaviour of quotes in bash variable assignments Andrei POPESCU <andreimpopescu@gmail.com> - 2020-09-23 12:00 +0200

csiph-web