On 17/6/24 14:20, David Wright wrote:
Just some random thoughts:

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.

Thanks David,


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:


alias srb='source  /home/keith/.bashrc'
#alias srz='source  ~/.zshrc'


alias rcrt='sudo crontab -e '
alias kcrt='crontab -e'

The editor changes the colour of the text from the opening ' to the next ' in the file. If that is the next alias while I am inserting a new one mid-file, the colour corrects when I type the closing ' That colour diff doesn't show here, but does in the editor - in the file I re-named for now.

I can see nothing different in the formatting of the reported error line from any others. And the supposed error worked from the moment I pasted it to the new file and ran

source .bashrc

One thing that still puzzles me is that when I #'d the errant line and source .bashrc the error still reported the same line Number - even when #'d out.


So, is an alias a form of variable?  I had about 150 plus 4 functions

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.

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


When I got my aliases working, I checked the size of the old file -
17K. The new .bash_aliases is 2.5K with .bash_functions at 490B.

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.


The errant function that failed after a little satisfactory use was to
mount a USB and back it up to my system. It is used to run portable
apps at a volunteer job - yes windows. I noticed that the sample
functions on the web didn't have && for each line, so I removed them
and performance is now back to what I expected.  The errant line was
the mount cmd. Originally if I had already mounted the USB, the
function kept going. I don't recall adding the &&, so it didn't dawn
on me to try removing them.  (I worked around it by unmounting it (an
alias) and trying the back-up again.)

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

17Jun2024@18:47:29


Cheers,
David.


--
All the best

Keith Bainbridge

keithr...@gmail.com
keith.bainbridge.3...@gmail.com
+61 (0)447 667 468

UTC + 10:00

Reply via email to