diff options
| author | Ville Skyttä <ville.skytta@iki.fi> | 2011-11-09 18:35:13 +0200 |
|---|---|---|
| committer | Ville Skyttä <ville.skytta@iki.fi> | 2011-11-09 18:35:13 +0200 |
| commit | 22dff29dc4b320d8a5a91341c46db4dc1e484891 (patch) | |
| tree | 6386105b4b51113186d385f9d65caa0c063d19c2 /bash_completion | |
| parent | 3f851722d7ec106b0cf4ec561dac45080c8e5d64 (diff) | |
| download | bash-completion-22dff29dc4b320d8a5a91341c46db4dc1e484891.tar.gz | |
_npus: Split out of lrzip for general use.
Diffstat (limited to 'bash_completion')
| -rw-r--r-- | bash_completion | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/bash_completion b/bash_completion index 76852c53..73ae920d 100644 --- a/bash_completion +++ b/bash_completion @@ -888,6 +888,14 @@ _available_interfaces() COMPREPLY=( $( compgen -W '${COMPREPLY[@]/%[[:punct:]]/}' -- "$cur" ) ) } +# Echo number of CPUs, falling back to 1 on failure. +_ncpus() +{ + local var=NPROCESSORS_ONLN + [[ $OSTYPE == *linux* ]] && var=_$var + local n=$( getconf $var 2>/dev/null ) + printf %s ${n:-1} +} # Perform tilde (~) completion # @return True (0) if completion needs further processing, |
