LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 10-05-2007, 03:15 PM   #1
meili100
LQ Newbie
 
Registered: Oct 2007
Posts: 25

Rep: Reputation: 15
*** how to set up a variable in Linux? ***


I am a newbie. I know this is a little off-stream of programming, but it is the problem when I tried to program in linux. I wonder if there is a way to set up a variable, say $VAR = /home/root, so that I can use
cd $VAR
instead of
cd /home/root
 
Old 10-05-2007, 03:26 PM   #2
puntjuh
Member
 
Registered: Apr 2006
Location: holland
Distribution: Gentoo / debian / suse / mint
Posts: 558

Rep: Reputation: 41
You are looking for this .

http://www.ee.surrey.ac.uk/Teaching/Unix/unix8.html

You can set them temporarily or too last for ever.

Last edited by puntjuh; 10-05-2007 at 03:28 PM. Reason: change of url and information
 
Old 10-05-2007, 08:31 PM   #3
ankit_mcgill
Member
 
Registered: Aug 2005
Location: Montreal
Distribution: OpenSuse 10.3
Posts: 65

Rep: Reputation: 15
on the prompt type

VR=/home/root

then CD $VAR should work like cd /home/root

note: this variable is only valid in the shell u defined it in. its a local variable

to make it permanent you would have to define it in ~/.bashrc
 
  


Reply


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
set variable in G_CALLBACK? bendeco13 Programming 2 05-12-2007 12:50 PM
How to set an environment variable royeo Linux - Newbie 1 12-01-2006 12:59 AM
How do you set the PATH variable ? DarkLeon Linux - Newbie 6 11-06-2006 03:26 PM
Set variable with value of another Ephracis Programming 7 12-25-2004 10:34 AM
Set Environment Variable lloyd_stevens Linux - Software 1 07-30-2003 12:38 PM


All times are GMT -5. The time now is 10:33 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration