darkrc/bin/scratch
DarkWiiPlayer 6a8d978bfd Add scratch script
This script creates a new temporary folder and starts a bash shell in
it. After the shell exits, the directory is deleted.
2018-11-06 14:36:31 +01:00

9 lines
234 B
Bash
Executable file

#!/bin/bash
export scratch=$(mktemp -d -t tmp.XXXXXXXXXX)
function finish {
echo "Deleting $scratch..."
rm -rf "$scratch"
}
trap finish EXIT
trap finish TERM
bash --init-file <(echo "source ~/.bashrc; pushd $scratch > /dev/null")