diff options
author | 2013-01-12 15:35:40 -0800 | |
---|---|---|
committer | 2013-01-12 15:35:40 -0800 | |
commit | acbb6fb8e2a12c9071b9729e4033cdb2a3d39c07 (patch) | |
tree | 115a57b958c9bfdfadff05cb48d9459aaaba15c7 /share/functions/umask.fish | |
parent | 11639619274d531429afb5a5895897da6d92ba41 (diff) |
Make umask work on OS X
Diffstat (limited to 'share/functions/umask.fish')
-rw-r--r-- | share/functions/umask.fish | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/share/functions/umask.fish b/share/functions/umask.fish index 44a0ca10..380dc199 100644 --- a/share/functions/umask.fish +++ b/share/functions/umask.fish @@ -138,19 +138,27 @@ function umask --description "Set default file permission mask" set -l as_command 0 set -l symbolic 0 - - set -l shortopt -o pSh - set -l longopt + + set -l options + set -l shortopt pSh if not getopt -T >/dev/null + # GNU getopt set longopt -l as-command,symbolic,help + set options -o $shortopt -l $longopt -- + # Verify options + if not getopt -n umask $options $argv >/dev/null + return 1 + end + else + # Old getopt, used on OS X + set options $shortopt + # Verify options + if not getopt $options $argv >/dev/null + return 1 + end end - if not getopt -n umask -Q $shortopt $longopt -- $argv >/dev/null - return 1 - end - - set -l tmp (getopt $shortopt $longopt -- $argv) - + set -l tmp (getopt $options $argv) eval set opt $tmp while count $opt >/dev/null |