LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   bash question? (https://www.linuxquestions.org/questions/linux-software-2/bash-question-259554/)

shanenin 11-26-2004 12:07 PM

bash question?
 
I have a question about bash syntax. I am using something out of the gentoo install guide as an example

Code:

CFLAGS="-march=athlon-xp -pipe -O2" 
CXXFLAGS="${CFLAGS}"

the line CXXFLAGS is supposed to have the same cflags as the above line, so why would it not be like this
Code:

CXXFLAGS="$CFLAGS"
what purpose do the brackets serve?

druuna 11-26-2004 12:22 PM

In the case of the example given, they are optional. There are many constructions where they are required, to mention just one:

${parameter:-word}

If you want the whole story: man bash, specifically the Parameter Expansion section.

On a personal note: I always use the brackets. I could be wrong, but I believe that's the way 'it's supposed to be done'.

Hope this helps.


All times are GMT -5. The time now is 03:50 PM.