LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 11-26-2004, 01:07 PM   #1
shanenin
Member
 
Registered: Aug 2003
Location: Rochester, MN, U.S.A
Distribution: Gentoo
Posts: 987

Rep: Reputation: 30
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?
 
Old 11-26-2004, 01:22 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
A question about BASH operand Linux - Newbie 2 11-27-2005 10:49 PM
Bash Question mbjunior99 Programming 5 08-31-2005 05:33 AM
a bash question about while jiawj Linux - Newbie 3 07-14-2005 12:45 PM
BASH question tpe Linux - Software 6 11-17-2004 09:59 PM
bash question shanenin Linux - Software 3 02-14-2004 07:10 PM


All times are GMT -5. The time now is 11:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration