darkrc/bin/scratch
DarkWiiPlayer 4fef56cdb8 Update scratch to allow running scripts
When passing any arguments to scratch, they will be executed as a
command in the temporary directory
2019-09-18 14:47:50 +02:00

17 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