From f4f6cb4a18eeca6453b9c643d27e57f0d08944cd Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sat, 7 Jun 2008 21:13:33 +0000 Subject: Add create-temp git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@355 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- create-temp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 create-temp 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" -- cgit v1.2.3