cc: Use parameter expansion instead of basename (#24509)

While debugging #24508, I noticed that we call `basename` in `cc`. The
same can be achieved by using Bash's parameter expansion, saving one
external process per call.

Parameter expansion cannot replace basename for directories in some
cases, but is guaranteed to work for executables.
This commit is contained in:
Michael Kuhn
2021-09-16 18:25:49 +02:00
committed by GitHub
parent d73fe19d93
commit 2d34acf29e

2
lib/spack/env/cc vendored
View File

@@ -128,7 +128,7 @@ fi
# ld link
# ccld compile & link
command=$(basename "$0")
command="${0##*/}"
comp="CC"
case "$command" in
cpp)