Created
April 27, 2020 17:18
-
-
Save liamnewmarch/90a6c1548a897c2faf627eda847398b9 to your computer and use it in GitHub Desktop.
Small utility to start a shell in a temporary directory and delete it afterwards
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
BLUE='\033[1;34m' | |
RESET='\033[0m' | |
WHITE='\033[1;37m' | |
echo -e "Creating temp dir..." | |
tempdir=$(mktemp -d) | |
pushd $tempdir &>/dev/null | |
echo -e "${BLUE}!${WHITE} Starting a new shell. Type ${BLUE}exit${WHITE} to return.${RESET}" | |
$SHELL | |
echo -e "Removing temp dir..." | |
popd &>/dev/null | |
rm -rf $tempdir | |
echo -e "Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment