LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-27-2007, 11:17 AM   #1
rpace78
LQ Newbie
 
Registered: Jun 2007
Posts: 5

Rep: Reputation: 0
Variable Help


I'm trying to create a variable and I'm not sure were to start. What is the command to create a variable?
Thanks
 
Old 06-27-2007, 11:56 AM   #2
nautilus
Member
 
Registered: Jun 2007
Location: London, Athens
Distribution: Debian, Ubuntu
Posts: 36

Rep: Reputation: 15
What kind of variable are we talking about? Environment variable? A variable in a programming language? You need to be a bit more specific my friend...
 
Old 06-27-2007, 02:39 PM   #3
rpace78
LQ Newbie
 
Registered: Jun 2007
Posts: 5

Original Poster
Rep: Reputation: 0
I'm trying to create a variable ($DOC) in the .bashrc file of my home directory.
 
Old 06-27-2007, 02:45 PM   #4
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
You can put the line "export DOC=contents" (replacing "contents" with what's meant to go in that variable, obviously) in your .bashrc. You'll need to "source" the file after changing it, either by typing "source .bashrc" or ". .bashrc" in the terminal.
 
Old 06-27-2007, 02:59 PM   #5
rpace78
LQ Newbie
 
Registered: Jun 2007
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Nylex
You can put the line "export DOC=contents" (replacing "contents" with what's meant to go in that variable, obviously) in your .bashrc. You'll need to "source" the file after changing it, either by typing "source .bashrc" or ". .bashrc" in the terminal.
Would my contents be /urs/share/doc ?
 
Old 06-27-2007, 03:00 PM   #6
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
I don't know.. surely you should know? . What are you using this variable for?
 
Old 06-27-2007, 03:04 PM   #7
rpace78
LQ Newbie
 
Registered: Jun 2007
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Nylex
I don't know.. surely you should know? . What are you using this variable for?

I'm using the variable as a shortcut to the files in /urs/share/doc
 
Old 06-27-2007, 03:26 PM   #8
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
If all you want to do is to be able to do "cd $DOC" as a shortcut for "cd /usr/share/doc", then yeah, that's fine.
 
Old 06-27-2007, 03:36 PM   #9
rpace78
LQ Newbie
 
Registered: Jun 2007
Posts: 5

Original Poster
Rep: Reputation: 0
When I type "export DOC /usr/share/doc" i get not a valid identifier.
Thanks for your help, I am truely a newie!!
 
Old 06-27-2007, 04:09 PM   #10
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Looks like an "=" is missing....
I seriously recommend some reading--maybe start with Bash Guide for Beginners--it's free at tldp.org
 
Old 06-27-2007, 04:34 PM   #11
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 5,959

Rep: Reputation: Disabled
If you desire to create a shortcut a symlink my serve you better.
 
  


Reply

Tags
variable


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
Replace variable with user defined variable ce124 Programming 10 04-13-2007 09:29 AM
setting a variable variable in a script... this works, but could it be more elegant? pwc101 Programming 3 08-18-2006 11:23 AM
Scripting: accessing a variable stored in a variable? tomolesonjr Linux - Newbie 5 05-05-2006 08:47 PM
Retrieving from a variable whose name is inside a variable. thekillerbean Linux - General 4 02-09-2006 08:50 PM
How to get 'Window' variable from a 'Widget' variable bordel Programming 0 11-19-2003 03:19 AM


All times are GMT -5. The time now is 08:14 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration