LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 05-10-2007, 09:25 AM   #1
ryan.greenwood
LQ Newbie
 
Registered: May 2007
Posts: 1

Rep: Reputation: 0
export - Invalid identifier for environment variable


SUSE

I am a Linux fledgling. I am attempting to set an environment variable, but I am receiving the following error message:

export RTT-TESTCONTEXT=/cygdrive/c/HelloWorld
bash: export: `RTT-TESTCONTEXT=/cygdrive/c/HelloWorld': not a valid identifier

The problem appears to be with the - between RTT and TESTCONTEXT?

Can anyone put me on the right path?

Thanks
 
Old 05-10-2007, 11:32 AM   #2
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499
Blog Entries: 2

Rep: Reputation: 68
looks like the shell does not allow dash as part of name.
In fact there is a special shell notation to provide a default value if the variable is unset. It uses the dash as part of notation:
Code:
miguel@babylon5:~> unset XXX
miguel@babylon5:~> echo "The default value if XXX is not set is ${XXX:-whatever}"
The default value if XXX is not set is whatever
miguel@babylon5:~>
may be you can use RTT_TESTCONTEXT instead ?

Last edited by marozsas; 05-10-2007 at 11:34 AM.
 
Old 05-27-2007, 10:22 PM   #3
ADxD_7
Member
 
Registered: May 2007
Location: CO
Distribution: Solaris , Redhat , Debian
Posts: 152

Rep: Reputation: 23
# RTT_TESTCONTEXT=/cygdrive/c/HelloWorld
# export RTT_TESTCONTEXT

unless /cygdrive/c/HelloWorld is a command of some kind and you want the output stored to the variable then it would be

# RTT_TESTCONTEXT="'/cygdrive/c/HelloWorld'"
# export RTT_TESTCONTEXT

You should get a bash scripting book... I know thats off subject but I love scripting and think everyone should check it out.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to export environment variable from a bash script dimaash Linux - Newbie 20 08-09-2011 07:12 AM
variable export in shell MarioT Programming 3 05-16-2006 11:52 PM
export cd variable? rjwhite Linux - Games 1 12-17-2005 05:47 PM
Export variable loopoo Linux - Newbie 4 08-08-2005 04:08 AM
BASH variable export Barbarian Programming 2 11-27-2001 08:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 01:13 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