save and go commands.
save command save the current path.
go command move to the last saved path.
saved command list all saves.
You can name saved paths.
go 1 move you to save 1
go libft move you to save libft
The name is optional.
The name cannot contains white space.
Add these functions to your rc file. (.zshrc, .bash_aliases, .profile, .bashrc, etc...)
function save()
{
if [ ! -d ~/save_path ]; then
mkdir ~/save_path
fi
pwd > ~/save_path/$1.save_path;
};
function go()
{
if [ -f ~/save_path/$1.save_path ]; then
cd `cat ~/save_path/$1.save_path`;
else
echo "The save $1 does not exists.";
fi
};
function saved()
{
if [ -d ~/save_path ]; then
ls -1 ~/save_path | grep ".save_path" | sed -E "s/.save_path$//"
fi
}You can change the command name by changing the function name.