diff options
author | 2006-12-13 03:11:18 +1000 | |
---|---|---|
committer | 2006-12-13 03:11:18 +1000 | |
commit | fd11f294bc0e1c35acae9e327026fdaa6b3546f9 (patch) | |
tree | cb317d9c0678e8d16e3a04f1ab352027d55ef870 /share/functions/umask.fish | |
parent | b3fa76c1beac9719d97917361a9d7fde2d678300 (diff) |
Use the math function instead of calling bc directly in various places
darcs-hash:20061212171118-ac50b-a40709edf008f3d725e3755d5282ae5a84818c88.gz
Diffstat (limited to 'share/functions/umask.fish')
-rw-r--r-- | share/functions/umask.fish | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/share/functions/umask.fish b/share/functions/umask.fish index 45f192fa..0c83a36a 100644 --- a/share/functions/umask.fish +++ b/share/functions/umask.fish @@ -2,7 +2,8 @@ function __fish_umask_parse -d "Internal umask function" # Test if already a valid octal mask, and pad it with zeros if echo $argv | sgrep -E '^(0|)[0-7]{1,3}$' >/dev/null - for i in (seq (echo 5-(echo $argv|wc -c)|bc)); set argv 0$argv; end + set -l char_count (echo $argv| wc -c) + for i in (seq (math 5 - $char_count)); set argv 0$argv; end echo $argv else # Test if argument really is a valid symbolic mask @@ -22,7 +23,8 @@ function __fish_umask_parse -d "Internal umask function" for i in 1 2 3 set tmp (echo $tmp|cut -c 2-) - set res[$i] (echo 7-(echo $tmp|cut -c 1)|bc) + set -l char_count (echo $tmp|cut -c 1) + set res[$i] (math 7 - $char_count) end set -l el (echo $argv|tr , \n) @@ -80,10 +82,10 @@ function __fish_umask_parse -d "Internal umask function" set val 4 end if echo $i |sgrep 'w' >/dev/null - set val (echo $val + 2|bc) + set val (math $val + 2) end if echo $i |sgrep 'x' >/dev/null - set val (echo $val + 1|bc) + set val (math $val + 1) end for j in $idx @@ -101,7 +103,7 @@ function __fish_umask_parse -d "Internal umask function" end for i in 1 2 3 - set res[$i] (echo 7-$res[$i]|bc) + set res[$i] (math 7 - $res[$i]) end echo 0$res[1]$res[2]$res[3] end |