Author: rmh
Date: 2006-02-11 17:34:21 +0000 (Sat, 11 Feb 2006)
New Revision: 1172

Modified:
   trunk/freebsd-utils/scripts/sbin/swapoff
   trunk/freebsd-utils/scripts/sbin/swapon
Log:
swap{on,off}: Accept -v (be verbose).

Modified: trunk/freebsd-utils/scripts/sbin/swapoff
===================================================================
--- trunk/freebsd-utils/scripts/sbin/swapoff    2006-02-11 12:16:42 UTC (rev 
1171)
+++ trunk/freebsd-utils/scripts/sbin/swapoff    2006-02-11 17:34:21 UTC (rev 
1172)
@@ -1,3 +1,18 @@
 #!/bin/sh
 set -e
-exec -a swapoff swapoff.real $@ >/dev/null
+
+args=""
+verbose=false
+while [ $# -gt 0 ]; do
+  case "$1" in
+    -v) verbose=true ;;
+    *)  if [ -n "${args}" ] ; then args="${args} $1" ; else args="$1" ; fi ;;
+  esac
+  shift
+done
+
+if ! ${verbose} ; then
+  exec >/dev/null
+fi
+
+exec -a swapoff swapoff.real ${args}

Modified: trunk/freebsd-utils/scripts/sbin/swapon
===================================================================
--- trunk/freebsd-utils/scripts/sbin/swapon     2006-02-11 12:16:42 UTC (rev 
1171)
+++ trunk/freebsd-utils/scripts/sbin/swapon     2006-02-11 17:34:21 UTC (rev 
1172)
@@ -2,12 +2,18 @@
 set -e
 
 args=""
+verbose=false
 while [ $# -gt 0 ]; do
   case "$1" in
+    -v) verbose=true ;;
     -e) ;;
     *)  if [ -n "${args}" ] ; then args="${args} $1" ; else args="$1" ; fi ;;
   esac
   shift
 done
 
-exec -a swapon swapon.real ${args} >/dev/null
+if ! ${verbose} ; then
+  exec >/dev/null
+fi
+
+exec -a swapon swapon.real ${args}


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to