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


Groups > linux.debian.user > #238189

Re: Bash script problem

From <tomas@tuxteam.de>
Newsgroups linux.debian.user
Subject Re: Bash script problem
Date 2021-08-05 10:40 +0200
Message-ID <CIH4Z-UG-1@gated-at.bofh.it> (permalink)
References <CIyXL-4iY-1@gated-at.bofh.it> <CIG8V-m5-3@gated-at.bofh.it> <CIGVk-Ry-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Thu, Aug 05, 2021 at 09:26:35AM +0100, Tixy wrote:
> On Thu, 2021-08-05 at 10:36 +0300, Anssi Saari wrote:
> [...]
> > 
> > [ A="0 ; " ]
> > 
> > is always true. It seems it probably has something to do with expansion,
> > quoting and the special meaning of ;.
> > 
> 
> ; has no special meaning inside "". The expression is true because
> there is only a single non-null argument between the [ ]

Yes, well put. As much as

  [ foobarbazxy ]

is always true :-)

I always recommend `echo' to those who want to "see" argument
expansion before pulling out their hair. Try

  echo A="0 ;  "
  => A=0 ;

Since whitespace is so difficult to see, let's prepend and postpend
something (the `-n' option tells echo to not output a newline):

  echo -n '<' ; echo -n A="0 ;  " ; echo '>'
  => <A=0 ;  >

Cheers
 - t

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


Thread

Bash script problem "Gary L. Roach" <garyroach719@gmail.com> - 2021-08-05 02:00 +0200
  Re: Bash script problem Greg Wooledge <greg@wooledge.org> - 2021-08-05 02:10 +0200
    Re: Bash script problem "Gary L. Roach" <garyroach719@gmail.com> - 2021-08-05 05:50 +0200
      Re: Bash script problem john doe <johndoe65534@mail.com> - 2021-08-05 09:00 +0200
      Re: Bash script problem <tomas@tuxteam.de> - 2021-08-05 10:10 +0200
        Re: Bash script problem Greg Wooledge <greg@wooledge.org> - 2021-08-05 13:20 +0200
          test vs. [ [was: Bash script problem] <tomas@tuxteam.de> - 2021-08-05 14:00 +0200
            Re: test vs. [ [was: Bash script problem] Greg Wooledge <greg@wooledge.org> - 2021-08-05 14:40 +0200
              Re: test vs. [ [was: Bash script problem] <tomas@tuxteam.de> - 2021-08-05 15:00 +0200
      Re: Bash script problem Greg Wooledge <greg@wooledge.org> - 2021-08-05 14:30 +0200
  Re: Bash script problem Anssi Saari <as@sci.fi> - 2021-08-05 09:40 +0200
    Re: Bash script problem Tixy <tixy@yxit.co.uk> - 2021-08-05 10:30 +0200
      Re: Bash script problem <tomas@tuxteam.de> - 2021-08-05 10:40 +0200
        Re: Bash script problem Greg Wooledge <greg@wooledge.org> - 2021-08-05 14:00 +0200
          Re: Bash script problem "Gary L. Roach" <garyroach719@gmail.com> - 2021-08-05 22:10 +0200
            Re: Bash script problem Greg Wooledge <greg@wooledge.org> - 2021-08-05 22:20 +0200
              Re: Bash script problem "Gary L. Roach" <garyroach719@gmail.com> - 2021-08-06 17:00 +0200
                Re: Bash script problem <tomas@tuxteam.de> - 2021-08-06 17:10 +0200
            Re: Bash script problem David <bouncingcats@gmail.com> - 2021-08-06 01:40 +0200
              Re: Bash script problem Greg Wooledge <greg@wooledge.org> - 2021-08-06 02:10 +0200
                Re: Bash script problem Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-08-06 02:20 +0200
                Re: Bash script problem Greg Wooledge <greg@wooledge.org> - 2021-08-06 02:30 +0200
                Re: Bash script problem The Wanderer <wanderer@fastmail.fm> - 2021-08-06 03:50 +0200
                Re: Bash script problem Greg Wooledge <greg@wooledge.org> - 2021-08-06 04:10 +0200
              Re: Bash script problem Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-08-06 02:10 +0200
                Re: Bash script problem Christian Groessler <chris@groessler.org> - 2021-08-06 02:30 +0200
                Re: Bash script problem Christian Groessler <chris@groessler.org> - 2021-08-06 03:00 +0200
                Re: Bash script problem Greg Wooledge <greg@wooledge.org> - 2021-08-06 03:10 +0200
                Re: Bash script problem David <bouncingcats@gmail.com> - 2021-08-06 03:10 +0200
                Re: Bash script problem David <bouncingcats@gmail.com> - 2021-08-06 03:00 +0200
                Re: Bash script problem <tomas@tuxteam.de> - 2021-08-06 09:00 +0200
              Re: Bash script problem David Wright <deblis@lionunicorn.co.uk> - 2021-08-06 05:10 +0200
                Re: Bash script problem David <bouncingcats@gmail.com> - 2021-08-06 05:50 +0200
              Re: Bash script problem Darac Marjal <mailinglist@darac.org.uk> - 2021-08-06 09:20 +0200
  Re: Bash script problem Tom Browder <tom.browder@gmail.com> - 2021-08-06 01:00 +0200

csiph-web