LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 07-31-2003, 07:17 AM   #1
Tarts
Member
 
Registered: Feb 2003
Distribution: Slackware 9.1 (exclusively) ;)
Posts: 344

Rep: Reputation: 30
Bash perm. evar set in /etc/profile help


Hi, i would like to set some perm env. variables for bash, i am able to do it for root and my user account, but when i change to su i lose my evars. Any ideas would be most appreciated, im using slackware 8.1 by the way.

{edit}
I think i can explain this better:
Code:
if [ "`id -u`" = "0"]; then
  echo $PATH | grep /usr/local/sbin 1> /dev/null 2> /dev/null
  if [ ! $? = 0 ]; then
    PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH
    export PATH=$PATH:/Exec
    HOWTO=/usr/doc/Linux-HOWTOs
    MINI=/usr/doc/Linux-mini-HOWTOs
    cdrw=/dev/scd0
    floppy=/dev/fd0h1440
  fi
fi
The above works for root, and i can do it for my user account,
but when i change to root with su from my user account i lose
my evars, hope that clears things up, thanks again.

Last edited by Tarts; 07-31-2003 at 10:21 AM.
 
Old 07-31-2003, 05:23 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,962
Blog Entries: 11

Rep: Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865
Try
su -
rather than su...

Cheers,
Tink
 
Old 08-01-2003, 10:59 AM   #3
Tarts
Member
 
Registered: Feb 2003
Distribution: Slackware 9.1 (exclusively) ;)
Posts: 344

Original Poster
Rep: Reputation: 30
Great! Let me guess 'man su', i don't know if i ever would have thought it was so easy, thank's though.
One more thing baffle's me:
Code:
[root][#] id -u && echo $?
0
0
[root][#]
How is:
Code:
if [ ! $? = 0 ]; then
true? (see code in post 1)
Thank's!

Last edited by Tarts; 08-01-2003 at 12:18 PM.
 
Old 08-01-2003, 05:13 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,962
Blog Entries: 11

Rep: Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865
Quote:
Originally posted by Tarts
Code:
if [ ! $? = 0 ]; then
You've mixed to things up ;)

It doesn't check for the uid there,
but for the existence of /sbin in the path.
$? holds the success of the grep

Cheers,
Tink
 
Old 08-01-2003, 05:34 PM   #5
Tarts
Member
 
Registered: Feb 2003
Distribution: Slackware 9.1 (exclusively) ;)
Posts: 344

Original Poster
Rep: Reputation: 30
Ahh i think i get it. One more thing, where can i learn more about this, is this bash programming? Thank's for the reply's.

Last edited by Tarts; 08-01-2003 at 05:55 PM.
 
Old 08-02-2003, 04:03 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,962
Blog Entries: 11

Rep: Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865
http://www.tldp.org/LDP/abs/abs-guide.html.tar.gz

:}

Cheers,
Tink
 
Old 08-02-2003, 08:38 PM   #7
Tarts
Member
 
Registered: Feb 2003
Distribution: Slackware 9.1 (exclusively) ;)
Posts: 344

Original Poster
Rep: Reputation: 30
The advanced bash scripting guide, i'm impressed! Thank's Tink.
 
Old 08-02-2003, 09:21 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,962
Blog Entries: 11

Rep: Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865
Pleasure mate...

Next time I'll give the link a meaningful name :}

Cheers,
Tink
 
  


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
cron and shell env variables lt_wentoncha Suse/Novell 5 07-16-2005 01:20 PM
setting env. variables arunsri Slackware 3 03-26-2005 05:49 AM
Suse ent 9.0 setting Env variables not staying. suncloud Linux - Enterprise 1 03-13-2005 03:13 AM
setting env variables globally raven Linux - General 6 02-21-2003 08:04 AM
Open GL env.variables UB_KMA Linux - Newbie 1 08-04-2002 05:41 PM


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