Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #238175
| From | "Gary L. Roach" <garyroach719@gmail.com> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Re: Bash script problem |
| Date | 2021-08-05 05:50 +0200 |
| Message-ID | <CICyl-6yN-3@gated-at.bofh.it> (permalink) |
| References | <CIyXL-4iY-1@gated-at.bofh.it> <CIz7r-4BD-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
[Multipart message — attachments visible in raw view] - view raw
Thanks for the help but I still have the problem of the if statement always being true. This time I enclosed the file so you can test it. Gary R On 8/4/21 5:04 PM, Greg Wooledge wrote: > On Wed, Aug 04, 2021 at 04:58:00PM -0700, Gary L. Roach wrote: >> Path="/Test/gary/run/something" >> IFS=/ >> read -a Array <<< $Path > You're setting IFS permanently for the whole script. It's usually better > to set it only for the duration of the single read command which uses > it. Also, read should always be used with the -r option, unless you want > backslash mangling to occur. > > IFS=/ read -ra Array <<< "$Path" > >> if [ A="0 ; " ] > This is incorrect, at least twice over. You need to separate each of > the arguments of the [ command with whitespace. > > if [ A = "0 ; " ] > > It helps if you remember that [ is simply a fancy synonym for the test > command. A more natural way to write this would be > > if test A = "0 ; " > > Next, you are comparing two constant strings, "A" and "0 ; ". This > comparison is not useful, because they are always different strings. > If A is a variable, then you probably meant to write this: > > if [ "$A" = "0 ; " ] >
Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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