#!/bin/bash BIN=/opt/google-earth/googleearth BASEDIR=$HOME/.googleearth TEMPDIR=$BASEDIR/Temp CACHEDIR=$BASEDIR/Cache mkdir -p -m 700 $BASEDIR subdir=googleearth-${USER:-${LOGNAME:-$(id -u)}} for s in $TEMPDIR:/tmp $CACHEDIR:/var/tmp; do dir=$(echo $s | cut -d: -f1) tmp=$(echo $s | cut -d: -f2) [ -d $dir ] && continue tmp=$tmp/$subdir-$RANDOM$$ [ -L $dir ] && tmp=$(readlink -f $dir) [ -d $tmp ] || mkdir -m 700 $tmp [ -L $dir ] || ln -s $tmp $dir done exec "$BIN" "$@"