diff options
author | Peter Palfrader <peter@palfrader.org> | 2008-06-07 21:13:33 +0000 |
---|---|---|
committer | weasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede> | 2008-06-07 21:13:33 +0000 |
commit | f4f6cb4a18eeca6453b9c643d27e57f0d08944cd (patch) | |
tree | 41e35c478930c304ebc7957c5ed5b9c2939a82e4 | |
parent | 5aa20aef91ff4b645d10c6ee599cd75235b43309 (diff) |
Add create-temp
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@355 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
-rwxr-xr-x | create-temp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/create-temp b/create-temp new file mode 100755 index 0000000..fe9da4c --- /dev/null +++ b/create-temp @@ -0,0 +1,19 @@ +#!/bin/sh + +set -e + +TODAY="$(date '+%F')" +BASE="$HOME/.temp" +TARGET="$HOME/tmp" + + +rmdir "$BASE/"* 2> /dev/null || true + +[ -d "$BASE/$TODAY" ] || mkdir "$BASE/$TODAY" +if ! [ -L "$TARGET" ] && [ -e "$TARGET" ]; then + echo "$0: '$TARGET' already exists and is not a symlink." >&2 + exit 1; +fi + +rm -f "$TARGET" +ln -s "$BASE/$TODAY" "$TARGET" |