Skip to content

Instantly share code, notes, and snippets.

@takac
Created August 8, 2014 07:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takac/ec832993cc695a14a519 to your computer and use it in GitHub Desktop.
Save takac/ec832993cc695a14a519 to your computer and use it in GitHub Desktop.
f()
{
LAST=$(fc -l | tail -1 | sed 's/^\s*[0-9]\+\s\+//')
CMMD=${LAST%% *}
if [[ ${CMMD} == "mkdir" ]]; then
cd "${LAST#* }"
elif [[ ${CMDD} == "cd" ]]; then
cd -
elif [[ ${CMDD} == "fish" ]]; then
cd -
else
echo "PART 1 is ${LAST[1]}"
echo "PART 2 is ${LAST[2]}"
echo "CMMD is ${CMMD}"
echo "LAST is ${LAST}"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment