Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.bashprofile can anyone verify if this is right

Status
Not open for further replies.

idiotboy

Programmer
Apr 20, 2001
21
GB
Many thanks for the help. Is this .bashprofile right?
I can execute commands in their respective directories e.g.
/sbin/shutdown -h 1 whilst pwd = /sbin but not execute it elsewhere using shutdown -h 1. I should be able to shouldn't I?

Or am I being stupid?


.bashprofile
if [-f ~/.bshrc];then
.~/bashrc
fi

PATH=$PATH:$HOME/sbin/:/bin:/usr/local/bin:/etc
env=$HOME/.bashrc
USERNAME= "root"
EXPORT USERNAME ENV PATH
MESG N

Thanks everyone,

idiotboy
 
add :/sbin at the end of the line beginning with path=

save the file, log out and log back in and your problem should be solved.

AV
tnedor@yahoo.com
 
If you are giving the full path to shutdown, it doesn't matter if /sbin is in your path.

So, what kind of error do you get when you try to execute shutdown? Are you doing this as root? If not, have you set up some means (such as sudo) for the account you're using to execute shutdown?

BTW, in that '.bash_profile', I assume the if condition is actually '.bashrc', not '.bshrc'.
 
all listings should end with a ":" and not a "/", just make sure of that or you may run into problems!

RNINJA
 
Hi,

having performed the changes advised by RNINJA and Golden Eternity (and yes the bashrc was a typo (doh!)) I still cannot type the shutdown command directly from the command line. My error message comes up with "bash:shutdown: command not found".

Am I being stupid? I shouldn't have to execute the command from the directory in which the exe sits should I? That's all sorted out by my profile. As you all know, I'm new to Linuix but not UNIX,

The syntax is correct (as it executes when I use the full path and in the exe's directory)

I am logged in as root.

My .bash_profile is as above with :/sbin:


Please forgive me for being slow. Is my basic problem this.....my server is setup (e.g. its all there and needs configuring) When I launch the command the system (.bash_profile) has not been setup to allow me to type the command (e.g. shutdown -k 1) from wherever I am and it will not recognize it until either (a) the .bash_profile has been corrected (b) the command is executed in the directory in which the exe exists (e.g. /sbin/shutdown -k 1)

I should be able to type shutdown -k 1 from anywhere shouldn't I? (Yes I am logged on as root). I thought that's what the .bash_profile did (hold all the paths that contain executables) and allow the root to execute these commands from wherever you desire (e.g. if my pwd = /usr/local/bin then I should still be able to adduser or shutdown or wall)

Please be patient with me!

If anyone has a link to a page of info could they post it or point me to it.

Thanks to

Mighty TIMSR GOLDEN ETERNITY RNINJA and THE RAT

Thanks for the help and patience

Thanks

idiotboy

 
Just some clarification:

are you logging on as root on one of the consoles, or are you using telnet / SSH to connect to the machine as a user and su-ing to root?

If it is the latter, try using "su -" rather than su...


AV
tnedor@yahoo.com
 
Does '/sbin/shutdown' exist on the system? Try running 'init 0' or 'telinit 0' to halt the system.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top