Home > Back-end >  -Wextra works in shell but not in bash script
-Wextra works in shell but not in bash script

Time:06-08

I was using today a bash script to perform some things that I need to execute a code, and I encountered with the error in the title. In the bash script, the shell says -Wextra command not found, but if I execute the command by myself:mpicc -Wall -Wextra -pedantic -o ptmm PerfTestMM.c -lblas it actually works. So I was wondering, why this could be caused? In the shell and in the bash script the very same command was run:

CC=mpicc
CFLAGS=-Wall -Wextra -pedantic
CFILE=PerfTestMM.c
EXE=ptmm
$($CC $CFLAGS -o $EXE $CFILE -lblas) 

CodePudding user response:

Thanks to @Biffen for the answer, CFLAGS=... has to be CFLAGS='...'.

  • Related