2018-11-06 13:36:31 +00:00
|
|
|
#!/bin/bash
|
2019-09-12 12:31:27 +00:00
|
|
|
export scratch=$(mktemp -p /dev/shm -d -t tmp.XXXXXXXXXX)
|
2019-09-18 12:31:20 +00:00
|
|
|
|
2018-11-06 13:36:31 +00:00
|
|
|
function finish {
|
|
|
|
rm -rf "$scratch"
|
|
|
|
}
|
2019-09-18 12:31:20 +00:00
|
|
|
|
2018-11-06 13:36:31 +00:00
|
|
|
trap finish EXIT
|
2019-09-18 12:31:20 +00:00
|
|
|
trap finish SIGTERM
|
|
|
|
|
2019-09-18 12:47:50 +00:00
|
|
|
if [ -z $1 ]
|
|
|
|
then
|
|
|
|
bash --init-file <(echo "source ~/.bashrc; pushd $scratch > /dev/null")
|
|
|
|
else
|
|
|
|
cd $scratch
|
|
|
|
"$@"
|
|
|
|
fi
|