Blender Git Loki

Git Commits -> Revision 554eca1

Revision 554eca1 by Lawrence D'Oliveiro (master)
February 22, 2014, 13:31 (GMT)
Avoid UUOC in install_deps.sh

The file ##build_files/build_environment/install_deps.sh## contains the following line:

THREADS=`cat /proc/cpuinfo | grep processor | wc -l`

The command within the backticks is a [[ http://catb.org/jargon/html/U/UUOC.html | Useless Use Of Cat ]].

A more compact way of writing the same thing (saving two subprocesses) is

THREADS=`grep -c processor /proc/cpuinfo`

or (using POSIX-preferred command-substitution parentheses instead of backticks)

THREADS=$(grep -c processor /proc/cpuinfo)

But the most compact, and least Linux-specific, way is to use the ##nproc##(1) command from the [[ http://www.gnu.org/software/coreutils/manual/html_node/nproc-invocation.html | GNU coreutils package ]]:

THREADS=$(nproc)

Reviewers: sergey, mont29

Reviewed by: mont29

Differential Revision: https://developer.blender.org/D255

Commit Details:

Full Hash: 554eca1c288ea5b6c02b7fb174bf20238918b809
Parent Commit: ea5090f
Committed By: Bastien Montagne
Lines Changed: +1, -1

1 Modified Path:

/build_files/build_environment/prepare_release_env.sh (+1, -1) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021