LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Variable Help (https://www.linuxquestions.org/questions/linux-newbie-8/variable-help-564862/)

rpace78 06-27-2007 12:17 PM

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

nautilus 06-27-2007 12:56 PM

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...

rpace78 06-27-2007 03:39 PM

I'm trying to create a variable ($DOC) in the .bashrc file of my home directory.

Nylex 06-27-2007 03:45 PM

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.

rpace78 06-27-2007 03:59 PM

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 ?

Nylex 06-27-2007 04:00 PM

I don't know.. surely you should know? :confused:. What are you using this variable for?

rpace78 06-27-2007 04:04 PM

Quote:

Originally Posted by Nylex
I don't know.. surely you should know? :confused:. What are you using this variable for?


I'm using the variable as a shortcut to the files in /urs/share/doc

Nylex 06-27-2007 04:26 PM

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.

rpace78 06-27-2007 04:36 PM

When I type "export DOC /usr/share/doc" i get not a valid identifier.
Thanks for your help, I am truely a newie!!

pixellany 06-27-2007 05:09 PM

Looks like an "=" is missing....
I seriously recommend some reading--maybe start with Bash Guide for Beginners--it's free at tldp.org

Emerson 06-27-2007 05:34 PM

If you desire to create a shortcut a symlink my serve you better.


All times are GMT -5. The time now is 06:59 AM.