[Bash-completion-devel] [SCM] bash-completion branch, master, updated. 1.3-532-gd54db35
Ville Skyttä
ville.skytta at iki.fi
Fri Nov 11 07:36:54 UTC 2011
On 11/09/2011 10:20 PM, Igor Murzov wrote:
>
>> + local var=NPROCESSORS_ONLN
>> + [[ $OSTYPE == *linux* ]] && var=_$var
>> + local n=$( getconf $var 2>/dev/null )
>> + printf %s ${n:-1}
>
> I don't know why, but on my system getconf works differently (note the leading underscore in the variable name):
>
> $ LANG=C getconf NPROCESSORS_ONLN
> getconf: Unrecognized variable `NPROCESSORS_ONLN'
> $ getconf _NPROCESSORS_ONLN
> 1
Um, the 2nd code line you quoted above should have added the underscore,
assuming this is a Linux system. Doesn't [[ $OSTYPE == *linux* ]]
evaluate to true on your system?
> Also, I think that number of cpus is not a good maximum. I do use `make -j2` or `make -j3` on single core machines and this gives me better cpu utilisation. There is also things like hyper-threading. Maybe it's better to offer as completions numbers up to 2 * n or at least n + 2?
Sure, for make something like n*2 sounds fine. In my experience,
hyperthreading enabled doubles the number of CPUs shown by the OS.
More information about the Bash-completion-devel
mailing list