diff options
author | 2006-11-30 00:00:04 +1000 | |
---|---|---|
committer | 2006-11-30 00:00:04 +1000 | |
commit | f64364ccedb86d2fe182ac321585dbdda15c2175 (patch) | |
tree | 164a9ababc1d1f7455a841858aef524836308c51 /share/functions/umask.fish | |
parent | 32502bfac804551d09249675e382d297676a880c (diff) |
Replace all internal uses of grep with sgrep, which is a wrapper around grep that strips away any GREP_OPTIONS. This is needed to avoid users who have added arbitrary switches to GREP_OPTIONS, thus changing its behaviour.
darcs-hash:20061129140004-ac50b-485ff6bfd71e9459ba62461f6e093ca5c9ddd664.gz
Diffstat (limited to 'share/functions/umask.fish')
-rw-r--r-- | share/functions/umask.fish | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/share/functions/umask.fish b/share/functions/umask.fish index 78ab0087..45f192fa 100644 --- a/share/functions/umask.fish +++ b/share/functions/umask.fish @@ -1,12 +1,12 @@ function __fish_umask_parse -d "Internal umask function" # Test if already a valid octal mask, and pad it with zeros - if echo $argv | grep -E '^(0|)[0-7]{1,3}$' >/dev/null + 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 echo $argv else # Test if argument really is a valid symbolic mask - if not echo $argv | grep -E '^(((u|g|o|a|)(=|\+|-)|)(r|w|x)*)(,(((u|g|o|a|)(=|\+|-)|)(r|w|x)*))*$' >/dev/null + if not echo $argv | sgrep -E '^(((u|g|o|a|)(=|\+|-)|)(r|w|x)*)(,(((u|g|o|a|)(=|\+|-)|)(r|w|x)*))*$' >/dev/null printf (_ "%s: Invalid mask '%s'\n") umask $argv >&2 return 1 end @@ -70,19 +70,19 @@ function __fish_umask_parse -d "Internal umask function" set mode set end - if not echo $perm|grep -E '^(r|w|x)*$' >/dev/null + if not echo $perm|sgrep -E '^(r|w|x)*$' >/dev/null printf (_ "%s: Invalid mask '%s'\n") umask $argv >&2 return end set val 0 - if echo $i |grep 'r' >/dev/null + if echo $i |sgrep 'r' >/dev/null set val 4 end - if echo $i |grep 'w' >/dev/null + if echo $i |sgrep 'w' >/dev/null set val (echo $val + 2|bc) end - if echo $i |grep 'x' >/dev/null + if echo $i |sgrep 'x' >/dev/null set val (echo $val + 1|bc) end |