Executable Aliases
- aliases.bsh
Because bash scripts do not use alias
by default, common external programs are soft-coded using an all-caps variable name (e.g. tar
is called using "${TAR}"
. Simply source aliases.bsh
and use the variables. For example, instead of hard-coding “tar” everywhere, use the variable TAR
so that when the need comes, it is easier to switch which executable gets called. When an alias variable is used, this variable should be surrounded by quotes, e.g. "${TAR}"
.
Variables should default to the common executable name, and allow the user to override them.
For example, SSH
defaults to ssh
. There are a number of ways to override this:
SSH=ssh2
- Finds the command on the path calledssh2
SSH=/usr/local/bin/ssh
- Uses a full pathfunction ssh3(){ SSH_FLAG=3 ssh -v ${@+"${@}"}; }; export -f ssh3; SSH=ssh3
- Use an exported functionecho '#!/usr/bin/env bash' > ~/foo; echo 'ssh -v ${@}' >> ~/foo; chmod 755 ~/foo; SSH=~/foo
Note
SSH="ssh -v"
will look for an executable called ssh -v
, instead of running ssh
with the -v
flag, as desired.
- GIT
Name/path of git executable
- Default:
git
- TAR
Name/path of tar executable
- Default:
tar
- DOCKER
Name/path of docker executable
- Default:
docker
- DOCKER_COMPOSE
Name/path of docker compose command
- Default:
docker compose
(note, this is a bash array by default)
- SINGULARITY
Name/path of singularity executable
- Default:
singularity
- NVIDIA_SMI
Name/path of nvidia-smi executable
- Default:
nvidia-smi
- NVCC
Name/path of nvcc executable
- Default:
nvcc
- SSH
Name/path of ssh executable
- Default:
ssh
- GPG
Name/path of gpg executable
- Default:
Favors
gpg2
if it’s installed, elsegpg