with-umask: New tool. DWISOTT.
[misc] / with-umask
diff --git a/with-umask b/with-umask
new file mode 100755 (executable)
index 0000000..644cffb
--- /dev/null
@@ -0,0 +1,12 @@
+#! /bin/sh -e
+
+prog=${0##*/}
+usage="usage: $prog MASK CMD [ARGS ...]"
+case $1,$# in
+  -h,*) echo "$usage"; exit 0 ;;
+  -*) echo >&2 "unknown option \`$1'"; exit 1 ;;
+  ,0 | *,1) echo >&2 "$usage"; exit 1 ;;
+esac
+umask $1
+shift
+exec "$@"