From 2d34acf29e83e5898ae754e9c2abe3d6722d1685 Mon Sep 17 00:00:00 2001 From: Michael Kuhn Date: Thu, 16 Sep 2021 18:25:49 +0200 Subject: 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. --- lib/spack/env/cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- cgit v1.2.3-60-g2f50