diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2010-04-02 11:32:38 +0200 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2010-04-02 11:32:38 +0200 |
commit | f0f3c02a3ccde07d3dc79577c7eca41ea3e8e86f (patch) | |
tree | d0aaab1de872a30a94555d2da3b501e13e18c217 /etc/functions/off | |
parent | 81ac4a06bff278f07620804b7d4120342b1f6522 (diff) |
Replace $var by ${var}
Diffstat (limited to 'etc/functions/off')
-rw-r--r-- | etc/functions/off | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/etc/functions/off b/etc/functions/off index 1edd2d8..adf666f 100644 --- a/etc/functions/off +++ b/etc/functions/off @@ -11,14 +11,14 @@ typeset -i force reboot simulate exit_ok=1 function execute { if (( simulate )) { - echo $* + echo ${*} } else { - $* || exit_ok=0 + ${*} || exit_ok=0 } } -while [[ $1 == -* ]] { - case $1 in +while [[ ${1} == -* ]] { + case ${1} in -n) simulate=1 ;; -r) reboot=1 ;; --force) force=1 ;; @@ -33,13 +33,13 @@ while [[ $1 == -* ]] { return 0 ;; -|--) shift; break ;; - *) echo "Unrecognized option: $1" >&2 ; return 1 ;; + *) echo "Unrecognized option: ${1}" >&2 ; return 1 ;; esac shift } # Don't shut down a server too easily -if [[ $force != 1 && $hosts[$HOST] == *:server:* ]] { +if [[ ${force} != 1 && ${hosts[$HOST]} == *:server:* ]] { print -P '%B%F{yellow}This seems to be a server... not shutting down%f%b' echo "Use 'off --force' if you really mean it" return 1 @@ -52,16 +52,16 @@ fi execute uinit -o text stop-all while read filesystem garbage; do - if [[ $garbage == *[12] ]] && fgrep -q $filesystem /etc/mtab; then - filesystems+=$filesystem + if [[ ${garbage} == *[12] ]] && fgrep -q ${filesystem} /etc/mtab; then + filesystems+=${filesystem} fi done < /etc/fstab -for filesystem in $filesystems; { - tune2fs=($(sudo tune2fs -l $filesystem | fgrep -i 'mount count' | grep -o '[0-9]*')) +for filesystem in ${filesystems}; { + tune2fs=($(sudo tune2fs -l ${filesystem} | fgrep -i 'mount count' | grep -o '[0-9]*')) if (( tune2fs[2] - tune2fs[1] < 5 )) { exit_ok=0 - echo "notice: filesystem $filesystem due to check in $((tune2fs[2] - tune2fs[1])) mounts" + echo "notice: filesystem ${filesystem} due to check in $((tune2fs[2] - tune2fs[1])) mounts" } } if (( reboot )) { |