[Bash-completion-devel] [SCM] bash-completion branch, master, updated. 1.3-532-gd54db35

Igor Murzov e-mail at date.by
Fri Nov 11 14:18:22 UTC 2011


On Fri, 11 Nov 2011 09:36:54 +0200
Ville Skyttä <ville.skytta at iki.fi> wrote:

> 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?

It does. I'm sorry for the noise, this code works fine. I failed to notice the underscore :(

> Sure, for make something like n*2 sounds fine.

Agreed :)

> In my experience, hyperthreading enabled doubles the number of
> CPUs shown by the OS.

I didn't know. Thanks for the information.


-- Igor



More information about the Bash-completion-devel mailing list