summaryrefslogtreecommitdiffstats
path: root/warp/filexp
diff options
context:
space:
mode:
Diffstat (limited to 'warp/filexp')
-rw-r--r--warp/filexp32
1 files changed, 32 insertions, 0 deletions
diff --git a/warp/filexp b/warp/filexp
new file mode 100644
index 00000000..b0d65435
--- /dev/null
+++ b/warp/filexp
@@ -0,0 +1,32 @@
+#!/bin/sh
+: expand filename
+case "$1" in
+ ~/*|~)
+ echo $1 | sed "s|~|${HOME-$LOGDIR}|"
+ ;;
+ ~*)
+ if /bin/test -f /bin/csh; then
+ /bin/csh -f -c "glob $1"
+ echo ""
+ else
+ name=`expr x$1 : '..\([^/]*\)'`
+ dir=`sed -n -e "/^${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'$'"/\1/" -e p -e q -e '}' </etc/passwd`
+ if /bin/test ! -d "$dir"; then
+ me=`basename $0`
+ echo "$me: can't locate home directory for: $name" >&2
+ exit 1
+ fi
+ case "$1" in
+ */*)
+ echo $dir/`expr x$1 : '..[^/]*/\(.*\)'`
+ ;;
+ *)
+ echo $dir
+ ;;
+ esac
+ fi
+ ;;
+*)
+ echo $1
+ ;;
+esac