#!/bin/bash It=$1 [ $# = 0 ] && It=it root="/tmp/$USER/$It" subdir="$root/$$.$RANDOM" mkdir -p $subdir [ -d "$root/last" ] && unlink "$root/last" ln -sf "$subdir" "$root/last" printf $subdir