FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 01-22-2012, 06:45 PM
Ioannis Vranos
 
Default How to set an environment variable question

Hi all.

I have seen 2 versions for the following:

export PATH=$PATH:/some_directory

and

export PATH=${PATH}:/some_directory


Is anyone of them better than the other? Or in other words, are '{'
and '}' redundant? (I don't know shell programming).


Thank you a lot,

--
Ioannis Vranos

http://cppsoftware.binhoster.com

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 01-22-2012, 08:57 PM
Nils Kassube
 
Default How to set an environment variable question

Ioannis Vranos wrote:
> I have seen 2 versions for the following:
>
> export PATH=$PATH:/some_directory
>
> and
>
> export PATH=${PATH}:/some_directory
>
>
> Is anyone of them better than the other? Or in other words, are '{'
> and '}' redundant? (I don't know shell programming).

In this case there is no difference. Braces are useful if you want to
mix variables and text. Try this to see the difference:

a=hell
echo $ao
echo ${a}o

The first echo command has no output because the variable "ao" is
undefined (unless you have set it for some reason). The second echo
command uses the contents of variable "a" and appends an "o".


Nils

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 01:04 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org