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


Groups > linux.debian.user > #238268

Re: Bash script problem

From "Gary L. Roach" <garyroach719@gmail.com>
Newsgroups linux.debian.user
Subject Re: Bash script problem
Date 2021-08-06 17:00 +0200
Message-ID <CJ9uh-10P-3@gated-at.bofh.it> (permalink)
References (2 earlier) <CIGVk-Ry-7@gated-at.bofh.it> <CIH4Z-UG-1@gated-at.bofh.it> <CIKcx-2Ph-9@gated-at.bofh.it> <CIRQJ-7vr-1@gated-at.bofh.it> <CIS0q-7yz-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 8/5/21 1:15 PM, Greg Wooledge wrote:
> On Thu, Aug 05, 2021 at 01:03:16PM -0700, Gary L. Roach wrote:
>> First, the IFS command sets the string separator. The default values are
>> space /n and one other. The / is not among them.
> Yes, we know that.  The issue is that you are setting IFS for the
> whole script, when you probably *should* be setting it only for a
> single command.
Oops. I guess I just misunderstood what you were saying. I made the 
change to IFS=/ read ... Works fine.
>> Second, why am I separating out the Path the way I am doing? I need to check
>> each level for existence then, if the level doesn't exist, create the
>> directory, cd to the directory, [...]
> Why can't you just mkdir -p the final directory?  This creates the
> parent directories as needed.
I've been using Debian for a long time but didn't realize you could do 
that. Well back to the drawing board.
>> [...] set chown and -x chmod. After that check the
>> next level and repeat the process until I run out of levels.
>>
>> What do you mean by "-x chmod"?  A directory *needs* the +x permission bit
>> to be set in order to function properly.
Oops. The -x is a typo. S/B +x.
>> file=/opt/foobar/share/foobar.conf
>> dir=${file%/*}
>> mkdir -p "$dir"
>> touch "$file"
>>
>> You're doing *way* too much work.  It's a gigantic X-Y problem.
I agree. I'm going back through the code and rewriting most of it.
>> I want to use this .sh file to automatically set up the Amanda backup system
> I don't know Amanda, so I can't help you with that part.
>
That part I can work out with time. Again thanks for the help.

I'm 85 years old and the brain sometimes isn't as adgal as it used to 
be. The short term memory sucks.

Gary R.

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