LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-11-2007, 08:13 PM   #1
slimm609
Member
 
Registered: May 2007
Location: Chas, SC
Distribution: slackware, gentoo, fedora, LFS, sidewinder G2, solaris, FreeBSD, RHEL, SUSE, Backtrack
Posts: 430

Rep: Reputation: 67
bash question


Does anyone know what the difference between the following is?

TEST="this test"

echo $TEST
response: this test

echo ${TEST}
resopnse: this test

so I was wondering what the {} in the second echo statement does different then the first one



Thanks
 
Old 06-11-2007, 08:49 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
the { } is used for what is called "brace expansion". To get an idea what it does, do these:

echo {a,z}

echo {a..z}


In your example, the braces do nothing.
 
Old 06-11-2007, 09:09 PM   #3
slimm609
Member
 
Registered: May 2007
Location: Chas, SC
Distribution: slackware, gentoo, fedora, LFS, sidewinder G2, solaris, FreeBSD, RHEL, SUSE, Backtrack
Posts: 430

Original Poster
Rep: Reputation: 67
that does not work for variables

i think it is used for an array

like
${TEST[2]}
which would out put the 3rd entry in the array


thanks

Last edited by slimm609; 06-11-2007 at 09:10 PM.
 
Old 06-12-2007, 04:47 AM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Copy & paste that (including the empty line) into
an xterm or similar :}
Code:
man bash
/   Parameter Expansion


Cheers,
Tink
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
BASH question robscott Linux - Software 3 11-23-2005 09:39 AM
Yet another bash question. pete1234 Programming 3 09-25-2005 03:22 PM
Bash Question mbjunior99 Programming 5 08-31-2005 04:33 AM
BASH question tpe Linux - Software 6 11-17-2004 08:59 PM
BASH question cxel91a Programming 6 12-31-2003 03:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:29 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
Open Source Consulting | Domain Registration