Keith Bainbridge
2024-06-16 08:20:01 UTC
Good evening Folk
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.
(An aside is that a function started failing but see later.)
I found this summary using search.brave.com:
linux maximum bash aliases
Bash aliases are a powerful way to customize your command-line
experience. While there is no strict limit on the number of aliases you
can define, there are some practical limitations to consider.
Practical Limitations
Environment Variables: Bash has a limit on the number of
environment variables it can store, which is typically around 32,000. If
you define too many aliases, you may exceed this limit, causing issues
with your shell.
Shell Scripting: Bash scripts have a limit on the number of
commands they can execute, which is typically around 64,000. If you
define too many aliases, you may exceed this limit, causing issues with
your shell scripts.
/// summary ends
So, is an alias a form of variable? I had about 150 plus 4 functions
So I re-did my .bash_aliases file with only the bits I NEED; and all is
back to normal.
Further searching suggested I could have a .bash_functions file, opened
by .bashrc like .bash_aliases. Guess I could call them anything? but
that only means I have to remember something I do differently from norm.
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.
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.)
So a question and mybe something related that may help somebody else.
--
All the best
Keith Bainbridge
***@gmail.com
***@gmail.com
+61 (0)447 667 468
UTC + 10:00
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.
(An aside is that a function started failing but see later.)
I found this summary using search.brave.com:
linux maximum bash aliases
Bash aliases are a powerful way to customize your command-line
experience. While there is no strict limit on the number of aliases you
can define, there are some practical limitations to consider.
Practical Limitations
Environment Variables: Bash has a limit on the number of
environment variables it can store, which is typically around 32,000. If
you define too many aliases, you may exceed this limit, causing issues
with your shell.
Shell Scripting: Bash scripts have a limit on the number of
commands they can execute, which is typically around 64,000. If you
define too many aliases, you may exceed this limit, causing issues with
your shell scripts.
/// summary ends
So, is an alias a form of variable? I had about 150 plus 4 functions
So I re-did my .bash_aliases file with only the bits I NEED; and all is
back to normal.
Further searching suggested I could have a .bash_functions file, opened
by .bashrc like .bash_aliases. Guess I could call them anything? but
that only means I have to remember something I do differently from norm.
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.
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.)
So a question and mybe something related that may help somebody else.
--
All the best
Keith Bainbridge
***@gmail.com
***@gmail.com
+61 (0)447 667 468
UTC + 10:00