A terminal command that lets you save directory paths as 'hops', so you can easily cd to your favourite paths.
- This does:
Installs pyyaml with pip3
Creates 'shell_hop_source' file
Appends "source 'shell_hop_source'" in ~/.bashrc
Tries to set permission to hop.py
Tries to restart terminal by sourcing ~/.bashrc
The following is the content of 'hop_shell_source':
export PATH=$PATH:----?where?----/hop-command
# hop.py returns:
# 1) output to be printed => print output
# 2) a path to a directory => cd to that path
hop ()
{
HOP=$(hop.py $@ 2>&1)
if [ -d "$HOP" ]; then
cd "${HOP}"
echo "Arrived @ $PWD"
else
echo "$HOP"
fi
}
# --------------------------------------------------------------
# Hop command --------------------------------------------------
source ----?where?----/hop_shell_source
# --------------------------------------------------------------