summaryrefslogtreecommitdiff
path: root/userforward
diff options
context:
space:
mode:
Diffstat (limited to 'userforward')
-rwxr-xr-xuserforward7
1 files changed, 4 insertions, 3 deletions
diff --git a/userforward b/userforward
index 5ca172f..de8e13f 100755
--- a/userforward
+++ b/userforward
@@ -1,18 +1,19 @@
#!/bin/sh
-if [ $# -ne 2 ]; then
- echo "Usage: userforward {account} {forward@address.somewhere}"
+if [ $# \< 2 -o $# \> 3 ]; then
+ echo "Usage: userforward {account} {forward@address.somewhere} [force]"
exit 1
fi
uid=$1
addr=$2
+force=$3
set -e
homedir=`getent passwd $uid | awk -F: '{print $6}';`
-if [ -e $homedir/.forward ]; then
+if [ -e $homedir/.forward -a "x$force" != "xforce" ]; then
echo "User \"$uid\" already has a .forward - exiting..."
exit 1
fi