where is my setenv ?

bluethundr

Member


Messages: 62

Well this seems sort of odd...

I am running the C Shell as my root shell and I am trying to set an environment variable with setenv, but it doesn't appear to be working:

Code:
[root@LBSD2:/usr/home/bluethundr]#setenv SUDOERS_BASE ou=sudoers,ou=services,dc=summitnjhome,dc=com
bash: setenv: command not found
[root@LBSD2:/usr/home/bluethundr]#setenv
bash: setenv: command not found
[root@LBSD2:/usr/home/bluethundr]#echo $SHELL
/bin/csh
[root@LBSD2:/usr/home/bluethundr]#which setenv

For that matter, why is bash telling me that this command isn't working when all indicators are that C is actually my shell?

Here is my root environment:

Code:
#Changing user information for root.
Login: root
Password: secret
Uid [#]: 0
Gid [# or name]: 0
Change [month day year]:
Expire [month day year]:
Class:
Home directory: /root
Shell: /bin/csh
Full Name: Charlie &
Office Location:
Office Phone:
Home Phone:
Other information:

Furthermore, why is this environment, which for all intents and purposes purports to be C Shell actually behaving as bash???

Code:
[root@LBSD2:/usr/home/bluethundr]#export HELLO=hello
[root@LBSD2:/usr/home/bluethundr]#echo $HELLO
hello
[root@LBSD2:/usr/home/bluethundr]#

Can someone offer a clue here?

Thanks in advance!
 
OP
bluethundr

bluethundr

Member


Messages: 62

my shell environment

here ya go!

Code:
[root@LBSD2:/usr/home/bluethundr]#env | grep SHELL
SHELL=/bin/csh

Yes setenv doesn't work and the bash command export does!

Code:
export SUDOERS_BASE='ou=sudoers,ou=services,dc=summitnjhome,dc=com'
[root@LBSD2:/usr/home/bluethundr]#echo $SUDOERS_BASE
ou=sudoers,ou=services,dc=summitnjhome,dc=com
 

gordon@

Well-Known Member
Developer

Reaction score: 85
Messages: 406

You are using bash. How did you become root? Did you use something like su -m or sudo bash?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,691
Messages: 39,290

bluethundr said:
Well this seems sort of odd...

I am running the C Shell as my root shell and I am trying to set an environment variable with setenv, but it doesn't appear to be working:

Code:
[root@LBSD2:/usr/home/bluethundr]#setenv SUDOERS_BASE ou=sudoers,ou=services,dc=summitnjhome,dc=com
[b]bash[/b]: setenv: command not found
[root@LBSD2:/usr/home/bluethundr]#setenv
[b]bash[/b]: setenv: command not found
[root@LBSD2:/usr/home/bluethundr]#echo $SHELL
/bin/csh
[root@LBSD2:/usr/home/bluethundr]#which setenv
You're running bash.

Compare:
Code:
dice@williscorto:~>echo $SHELL
/bin/tcsh
dice@williscorto:~>setenv
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/home/dice/bin
{ Cut for abreviation }
HOST=williscorto.dicelan.home
REMOTEHOST=
WRKDIRPREFIX=/tmp/build/
DISTDIR=/storage/FreeBSD/distfiles/
TZ=Europe/Amsterdam
CLICOLOR=
TITLE=%{\033]0;%n@%m:%~\007%}
dice@williscorto:~>bash
[dice@williscorto ~]$ echo $SHELL
/bin/tcsh
[dice@williscorto ~]$ setenv
[b]bash[/b]: setenv: command not found
[dice@williscorto ~]$

which(1) will never find setenv because it's a shell build-in.
 

jalla

Well-Known Member

Reaction score: 86
Messages: 385

Sure, which will find built-ins (and aliases too).

i.e.
Code:
snapper:~% which setenv
setenv: shell built-in command.
snapper:~% which vc
vc:      aliased to vi ~/.cshrc;source ~/.cshrc
 
OP
bluethundr

bluethundr

Member


Messages: 62

bash / csh /tcsh

well to clarify I have a nasty habit of typing sudo bash when I want to become root but not change directories as would happen when I type su - root. My guess is that is why I was really in a bash environment when all other indicators pointed to csh! :p

Bad me! Quick opinion survery.. how do you like to become root?
 

Galactic_Dominator

Active Member

Reaction score: 37
Messages: 196

UNIXgod said:
When ssh'd into a box as a user I us `su`

If I'm at the box I'll log in as root.
Here too.
My guess is that is why I was really in a bash environment when all other indicators pointed to csh!
Did you happen to notice the prompt? csh and tcsh require customization to display similar prompts. Bash users must often forget $PWD or something.
 
Top