Re: Looping Shell Scripts and System Load

2020-06-25 Thread David
On Thu, 25 Jun 2020 at 19:23, Tixy wrote: > On Wed, 2020-06-24 at 13:43 -0400, Greg Wooledge wrote: > [Lots of good shell scripting advice snipped] > Thanks Greg for posting these code reviews of people's scripts, it's > not just the script authors which might learn something, but also some >

Re: Looping Shell Scripts and System Load

2020-06-25 Thread Tixy
On Wed, 2020-06-24 at 13:43 -0400, Greg Wooledge wrote: [Lots of good shell scripting advice snipped] Thanks Greg for posting these code reviews of people's scripts, it's not just the script authors which might learn something, but also some of us list subscribers. :-) -- Tixy

Re: Looping Shell Scripts and System Load

2020-06-24 Thread Martin McCormick
Greg Wooledge writes: > All-caps names are reserved for environment variables (HOME, PATH), > and internal shell variables (IFS, PWD, HISTFILE). > > Avoiding all-caps names allows you to avoid collisions with a variable > name that might be used for something else. Most of the time. This >

Re: Looping Shell Scripts and System Load

2020-06-24 Thread David Christensen
On 2020-06-24 10:19, Martin McCormick wrote: I wrote a shell script that unzips documents and I originally wrote it such that it gets document #1, unzips it then gets document #2, etc and it does that just fine so I wondered if I could make it run faster by starting several processes at once,

Re: Looping Shell Scripts and System Load

2020-06-24 Thread Kamil Jońca
Greg Wooledge writes: > On Wed, Jun 24, 2020 at 08:23:18PM +0200, Roger Price wrote: >> On Wed, 24 Jun 2020, Greg Wooledge wrote: >> >> > > MEDIADIR=`pwd` >> > >> > Don't use all caps variable names. >> >> Without getting into syntax-religious wars, what is the reasoning behind >> this

Re: Looping Shell Scripts and System Load

2020-06-24 Thread Greg Wooledge
On Wed, Jun 24, 2020 at 08:23:18PM +0200, Roger Price wrote: > On Wed, 24 Jun 2020, Greg Wooledge wrote: > > > > MEDIADIR=`pwd` > > > > Don't use all caps variable names. > > Without getting into syntax-religious wars, what is the reasoning behind > this recommendation? Roger All-caps names

Re: Looping Shell Scripts and System Load

2020-06-24 Thread Roger Price
On Wed, 24 Jun 2020, Greg Wooledge wrote: MEDIADIR=`pwd` Don't use all caps variable names. Without getting into syntax-religious wars, what is the reasoning behind this recommendation? Roger

Re: Looping Shell Scripts and System Load

2020-06-24 Thread D. R. Evans
Martin McCormick wrote on 6/24/20 11:19 AM: > > Right now, uptime looks like: > > 11:48:07 up 26 days, 23:10, 7 users, load average: 16.15, 15.60, 10.65 > > That's pretty loaded so ideally, one could start the > looping script and it would fire up processes until things got >

Re: Looping Shell Scripts and System Load

2020-06-24 Thread Greg Wooledge
On Wed, Jun 24, 2020 at 01:24:23PM -0400, Roberto C. Sánchez wrote: > I recommend you look at the parallel package. It is specifically geared > toward parallelization of constructed shell command lines. Think > something along the lines of "find -exec " but with the ability > to

Re: Looping Shell Scripts and System Load

2020-06-24 Thread Greg Wooledge
On Wed, Jun 24, 2020 at 12:19:30PM -0500, Martin McCormick wrote: > #!/bin/sh Why? Use bash. > unarchive () { > unzip $1 Quotes. > MEDIADIR=`pwd` Don't use all caps variable names. Don't use backticks. Use $() for command substitution. Don't use

Re: Looping Shell Scripts and System Load

2020-06-24 Thread Roberto C . Sánchez
On Wed, Jun 24, 2020 at 12:19:30PM -0500, Martin McCormick wrote: > I wrote a shell script that unzips documents and I originally > wrote it such that it gets document #1, unzips it then gets > document #2, etc and it does that just fine so I wondered if I > could make it run faster by starting