#!/bin/bash # # This is a collection of functions that manages a file /tmp as defined by # $WDIR_PATH set in .bashrc. They basicaly manage a 'working directory', which # the path of is stored in said file in /tmp. # # The .bashrc reads the path to the directory from the file and cd's into it # when a new shell is created. # Set the working directory. wdir() { wdir="$PWD/$1" [ -d "$wdir" ] && echo "$wdir" > "$WDIR_PATH" && echo "set $wdir" } # Print the workind directory. pwdir() { if [ -f "$WDIR_PATH" ] then cat "$WDIR_PATH" else echo "Working directory not set." fi } # Clear the workind directory. cwdir() { if [ -f "$WDIR_PATH" ] then rm -f "$WDIR_PATH" echo "Cleared working directory." else echo "Working directory not set." fi }