summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichael Kuhn <michael.kuhn@ovgu.de>2021-09-16 18:25:49 +0200
committerGitHub <noreply@github.com>2021-09-16 16:25:49 +0000
commit2d34acf29e83e5898ae754e9c2abe3d6722d1685 (patch)
treec73304c8600e13d2d89ca640a1a74d00f6a2e72b /lib
parentd73fe19d931f22307e5118b3f788304665de2db1 (diff)
downloadspack-2d34acf29e83e5898ae754e9c2abe3d6722d1685.tar.gz
spack-2d34acf29e83e5898ae754e9c2abe3d6722d1685.tar.bz2
spack-2d34acf29e83e5898ae754e9c2abe3d6722d1685.tar.xz
spack-2d34acf29e83e5898ae754e9c2abe3d6722d1685.zip
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.
Diffstat (limited to 'lib')
-rwxr-xr-xlib/spack/env/cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/spack/env/cc b/lib/spack/env/cc
index a573b2e237..b603c3bc32 100755
--- a/lib/spack/env/cc
+++ b/lib/spack/env/cc
@@ -128,7 +128,7 @@ fi
# ld link
# ccld compile & link
-command=$(basename "$0")
+command="${0##*/}"
comp="CC"
case "$command" in
cpp)