darkrc/bin/scratch

18 lines
271 B
Bash
Executable File

#!/bin/bash
export scratch=$(mktemp -p /dev/shm -d -t tmp.XXXXXXXXXX)
function finish {
rm -rf "$scratch"
}
trap finish EXIT
trap finish SIGTERM
if [ -z $1 ]
then
bash --init-file <(echo "source ~/.bashrc; pushd $scratch > /dev/null")
else
cd $scratch
"$@"
fi