DEV Community

Discussion on: The case against aliases

Collapse
 
tatsh profile image
Andrew Udvare

I have a lot of aliases and functions. I have a script that generates them based on the system in question so I can avoid runtime checks of whether the necessary applications are present. Most of my aliases come from this script. The only drawback is I have to remember to run this script and source my aliases again once in a while.

The script has a list of 'simple aliases', where this list of tuples has the required application, the name of the alias, and the actual command:

simple_aliases = (('jhead', 'strip-exif', 'jhead -purejpg'),)

then it checks for the binary in PATH and adds the alias if it finds it.

I do not yet generate the functions output but I probably will soon, based on the dependencies.

Nowadays I prefer functions unless the alias is very simple like alias la='ls -la' or something I really don't feel like remembering: alias ltr='-l --sort=time -r.

The problem may be that completions are generally not available in Bash by default, and I know I find them invaluable, and I write my own quite a bit.

Collapse
 
turbobasic profile image
andriy melnyk ╔╬╚╗╠ ╠╣╔╦╣╚╗╔╬╗

Great! I also rely on history and filter (do not capture) ls and some often used commands to make it shorter