LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   setting env. variables (https://www.linuxquestions.org/questions/slackware-14/setting-env-variables-306238/)

arunsri 03-26-2005 05:35 AM

setting env. variables
 
hi grp i'm using slack 10.1.

1) How do I set environmental variables? setenv does not work.Is there any other method?

2) For setting PATH...do i need to always wdit the /etc/profile?? There is no .bashrc in slack.But, can I create my own .bashrc and like that for every user?

macemoneta 03-26-2005 05:47 AM

If you're using bash, then to set an environment value:

variable1=value
variable2=value
export variable1 variable2

Bash expects to find a ~/.bashrc and ~/.bash_profile for each user (in addition to using the system /etc/bashrc and /etc/profile files).

keefaz 03-26-2005 05:48 AM

1) setenv is C shell syntax, slackware use bash by default (bourne shell) so the syntax is like:
PATH=/usr/bin:/bin:/usr/X11R6/bin
VISUAL=vim

2) yes

chbin 03-26-2005 05:49 AM

Re: setting env. variables
 
Quote:

Originally posted by arunsri
hi grp i'm using slack 10.1.

1) How do I set environmental variables? setenv does not work.Is there any other method?

2) For setting PATH...do i need to always wdit the /etc/profile?? There is no .bashrc in slack.But, can I create my own .bashrc and like that for every user?

For temp varaibles, ones that get chucked after you exit that shell instance..

$ export $VAR
if you want to get rid of it without exiting the shell
$ unset VAR

Set PATH only for that shell instance.
$ export PATH=$PATH:/opt/kde

if you forget the $PATH:, then the only thing in you path will be /opt/kde.

play around the echo $WHATEVER. You can see all variable that begin with C by echo $C ... tab.

To set them for ever instance of a shell put them in you /etc/profile..global
or ~/.profilerc only for only a specific user.


All times are GMT -5. The time now is 01:26 PM.