This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: pass bash variable as argument to gcc
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: staticx <mohamedboussaa3 at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Sat, 31 Oct 2015 11:43:03 +0530
- Subject: Re: pass bash variable as argument to gcc
- Authentication-results: sourceware.org; auth=none
- References: <1446123464157-1199673 dot post at n5 dot nabble dot com>
On 29/10/2015, staticx wrote:
> I wonder if I can pass the content of a bash variable as an argument to
> gcc.
> My variable is a list of optimization options like $var="-opt1 -opt2 -opt3"
> gcc $var test.c -o object.o didn't work
Because that's not how you set shell variables.
It should be var="..." not $var="..."
This has nothing to do with GCC, you're just using the shell wrong.