On Mon 17 Jun 2024 at 18:47:41 (+1000), Keith Bainbridge wrote:
> On 17/6/24 14:20, David Wright wrote:
> > On Sun 16 Jun 2024 at 18:13:36 (+1000), Keith Bainbridge wrote:
> > > 
> > > Some of my aliases stopped working after months of working as I
> > > expected. And udating the .bash_aliases kept giving me an error
> > > referring to an end of file before the matching ' in one of the last
> > > aliases.  So I did some searching.
> > 
> > All the aliases that lie textually after the one with the missing '
> > will remain undefined, so you can use bisection to locate where in
> > the file problem lies.
> 
> If I didn't use a syntax matching editor this may have easily been my
> problem.
> 
> This is the line that was being reported as the incomplete alias, and
> a few that follow it:

Once you open, and don't close, a quote, then bash is likely to try
to "bend" everything to suit, as it parses more lines. Frequently
it will only give up at the end of the file. So any reported line
number is likely to be meaningless.

That's why I recommended you source the file from a clean bash shell
and check which alias definitions have become defined, and which
haven't. Those that get "eaten up" in the runaway quote will not
get defined.

> > There's little chance of hitting bash's limits unless you're
> > generating the aliases or functions programmatically, and they'd
> > need naming systematically for you to be able to remember them all.
> > 
> As I said to Greg - I don't understand this; so I don't know how I
> would have done it.

I've seen no evidence of exceeding a limit of aliases or functions.

> > > So I re-did my .bash_aliases file with only the bits I NEED; and all
> > > is back to normal.
> > 
> > It looks like the error was in something that you judged you didn't need,
> > and you removed it.
> 
> No. The alias worked as soon as I activated it

You don't say which alias, nor all that had been done up to that
point, so that doesn't convey much information to me here. Or by
"activating the alias", do you mean sourcing the aliases file?

I was under the impression that you severely pruned your aliases
file from 17000 to 2500 characters, and that the larger file had an
unmatched ' and the smaller one didn't. It would seem reasonable
to suppose that the unmatched ' was in the prunings, the bits
you said you didn't need.

> > In any case, the bash limits you quoted were concerned with the number
> > of definitions, not the size of the files containing them.
> > 
> > Interesting that your aliases are on average as big as your functions.
> > About 90 of my aliases occupy 3.5k, whereas ~350 functions occupy 240k,
> > so averaging around 40 and 680 characters each, respectively.
> 
> To clarify the file sizes. The original 17K was about 150 aliases plus
> 4 functions. The new aliases file at 2.5k is about 40 aliases plus
> several comments and blank lines. The finctions file is new yesterday
> and has 2 functions (one of them 2 short commands).  I'll not likely
> get my functions much bigger - in the short term anyhow.

Really, I was only interested in the file sizes as an indication of
how long (and possibly complex) your aliases were.

> > I don't follow what this is about, particularly each line having (or
> > not having) a &&.
> 
> The only reason I raised this matter was that I had opened saying that
> my aliases were working. I originally thought that the function was my
> first sign of a problem  My ERROR. It became as aside to the question
> of env variable limits

Fair enough. But I still don't see anything reported that would cause
you to approach bash's limits except by, say, an accidental loop.

Cheers,
David.

Reply via email to