Re: [gentoo-user] .bashrc over ssh

2003-12-10 Thread Oliver Lange
Eric Paynter wrote:
mv ~/.bash_profile ~/.bash_profile.bkp
ln -s ~/.bashrc ~/.bash_profile
Then you get the same thing, no matter how you started the shell.
Also, you can edit either file and the other gets the edits, since
they are really both the same file, just with two names.
Interesting. Thank you.

--
[EMAIL PROTECTED] mailing list


Re: [gentoo-user] .bashrc over ssh

2003-12-10 Thread Oliver Lange
Ric Messier wrote:
On Tue, 9 Dec 2003, Eric Paynter wrote:

The problem with symlinking one to the other as you suggest is if you ever 
use something like scp, you potentially break it, as the comment in 
.bashrc says. All my profile-ish things that generate output get put, 
correctly, into .bash_profile. Of course, if you never generate output 
with your login scripts then you're ok. Just something to keep in mind, 
though.
Good to know... I'll be careful :)

--
[EMAIL PROTECTED] mailing list


Re: [gentoo-user] .bashrc over ssh

2003-12-10 Thread mathieu perrenoud
Le Mercredi, 10 Décembre 2003 11.21, Oliver Lange a écrit :
 Ric Messier wrote:
  On Tue, 9 Dec 2003, Eric Paynter wrote:
 
  The problem with symlinking one to the other as you suggest is if you
  ever use something like scp, you potentially break it, as the comment in
  .bashrc says. All my profile-ish things that generate output get put,
  correctly, into .bash_profile. Of course, if you never generate output
  with your login scripts then you're ok. Just something to keep in mind,
  though.

 Good to know... I'll be careful :)

pick my solution:
Create a new rc file with all your common configuration (mine is .scriptrc) 
and have it sourced by both .bashrc and .bash_profile
that way, you can put bashrc-only and bash_profile-only configs in their 
respective file.

-- 
mathieu perrenoud

--
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] .bashrc over ssh

2003-12-10 Thread Oliver Lange
Eric Paynter wrote:
Gentoo by default sources .bashrc from .bash_profile which is, of
course,  why I asked what shell he is using. If .bashrc isn't
getting run, then  perhaps he has a different shell without
realizing it.
Or perhaps he doesn't have a .bash_profile...

I have a .bash_profile, but i'm not sure if and which shell i'm using.
I can only say this: i've installed gentoo. How can i fugure out which
shell is set for my user and for the root account ?
The strange thing is that .bash_logout is always executed, but not
the .bashrc file. The .bashrc and .bash_profile permission bits
don't include the executable bit, and the .bash_profile contains this:
--

# /etc/skel/.bash_profile:
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/skel/.bash_profile,v 1.10 2002/11/18 19:39:22 
azarah Exp $

#This file is sourced by bash when you log in interactively.
[ -f ~/.bashrc ]  . ~/.bashrc
--

--
[EMAIL PROTECTED] mailing list


Re: [gentoo-user] .bashrc over ssh

2003-12-10 Thread Oliver Lange
Eric Paynter wrote:

Or perhaps he doesn't have a .bash_profile...

Addendum:

I just found out that everything works fine as long i'm
logging in under my user account - the problem only occurs
when i login as root, even local login won't execute the
.bashrc in /root, no matter if i login locally or over ssh.
--
[EMAIL PROTECTED] mailing list


Re: [gentoo-user] .bashrc over ssh

2003-12-10 Thread David Gethings
On Wed, 2003-12-10 at 14:12, Oliver Lange wrote:
 Eric Paynter wrote:
 Gentoo by default sources .bashrc from .bash_profile which is, of
 course,  why I asked what shell he is using. If .bashrc isn't
 getting run, then  perhaps he has a different shell without
 realizing it.
  
  Or perhaps he doesn't have a .bash_profile...
  
 
 I have a .bash_profile, but i'm not sure if and which shell i'm using.
 I can only say this: i've installed gentoo. How can i fugure out which
 shell is set for my user and for the root account ?
Either look in /etc/passwd or run 'echo $SHELL'.

If you are using bash then the system wide bash config file /etc/profile
will be used. It should then call your own .bash_profile. This in turn
can execute a .bashrc file.

As you rightly pointed out neither .bashrc nor .bash_profile are
executable. For the line in your .bash_profile to include your config in
.bashrc make it executable (chmod u+x .bashrc).

I am not sure but I think /etc/profile 'source's your .bash_profile so
it does not need to be executable. But I would check /etc/profile to
make sure.

Hope that helps.

Dg


--
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] .bashrc over ssh

2003-12-10 Thread mathieu perrenoud

 I have a .bash_profile, but i'm not sure if and which shell i'm using.
 I can only say this: i've installed gentoo. How can i fugure out which
 shell is set for my user and for the root account ?

finger username
grep username /etc/passwd | awk -F: '{print $7}'

use chsh to change your shell.

 The strange thing is that .bash_logout is always executed, but not
 the .bashrc file. The .bashrc and .bash_profile permission bits
 don't include the executable bit, and the .bash_profile contains this:

add echoes in your .bash* files, like:

echo executing bashrc
echo executing bash_profile

so you can see when each file is sourced.

And neither bashrc nor bash_profile needs the x bit, since they're sourced and 
not executed.

 # /etc/skel/.bash_profile:
 # $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/skel/.bash_profile,v
 1.10 2002/11/18 19:39:22 azarah Exp $

 #This file is sourced by bash when you log in interactively.
 [ -f ~/.bashrc ]  . ~/.bashrc


-- 
mathieu perrenoud

--
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] .bashrc over ssh

2003-12-10 Thread Ric Messier
On Wed, 10 Dec 2003, Oliver Lange wrote:

 
 I have a .bash_profile, but i'm not sure if and which shell i'm using.
 I can only say this: i've installed gentoo. How can i fugure out which
 shell is set for my user and for the root account ?
 

Yep. Which again leads me to believe that somehow you aren't using bash as 
your shell. While you are logged in, you can type echo $SHELL or echo 
$shell (csh uses lower case while bourne-related shells use upper).

You can also cat or grep /etc/passwd to get your shell setting or, if you 
have installed finger, you can finger your user. To set bash as your 
shell, use the following:

usermod -s /bin/bash username

Ric

--
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] .bashrc over ssh

2003-12-10 Thread Ric Messier

On Wed, 10 Dec 2003, David Gethings wrote:

 
 As you rightly pointed out neither .bashrc nor .bash_profile are
 executable. For the line in your .bash_profile to include your config in
 .bashrc make it executable (chmod u+x .bashrc).


No, you don't need to do that. The . tells it to be parsed. You only need 
it to be executable if you want to execute it directly -- ie, ~/.bashrc or 
just .bashrc if you are already in your home directory.

Ric

--
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] .bashrc over ssh

2003-12-10 Thread Patrick Börjesson
 add echoes in your .bash* files, like:
 
 echo executing bashrc
  ^^ I wouldn't recommend this as some things (like ssh) won't like the
output when sourcing .bashrc AFAIK

Patrick Börjesson

-- 
Public key ID: 4C5AB0BF
Public key available at wwwkeys.pgp.net


pgp0.pgp
Description: PGP signature


Re: [gentoo-user] .bashrc over ssh

2003-12-10 Thread Mike Williams
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Wednesday 10 December 2003 01:02, Oliver Lange wrote:
 Ric Messier wrote:
  What do you have set for your shell?

 Sorry, i don't understand the question, but there are
 so many (different!!) replies to my initial question
 that i guess the answer is already there... i just got
 to try them all :)

 Amazing how many different solutions i've already seen.

If you have to run 'bash' when you login I'd say your shell isn't bash.
My shell is bash:
sauron root # grep mike /etc/passwd
mike:x:1000:100:Mike Williams:/home/mike:/bin/bash

I also have this:
#This file is sourced by bash when you log in interactively.
[ -f ~/.bashrc ]  . ~/.bashrc

in my .bash_profile

- -- 
Mike Williams
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/1z4dInuLMrk7bIwRAqdMAJ4iEjulumIGpZmvkopWvo7LG1vqhACfWDn/
fBwUTp4D8/1vVG5sJ94LElE=
=tJuy
-END PGP SIGNATURE-

--
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] .bashrc over ssh

2003-12-10 Thread mathieu perrenoud
Le Mercredi, 10 Décembre 2003 16.31, Patrick Börjesson a écrit :
  add echoes in your .bash* files, like:
 
  echo executing bashrc

   ^^ I wouldn't recommend this as some things (like ssh) won't like the
 output when sourcing .bashrc AFAIK

yes right, but that's only for testing purposes.
ssh won't complain, but sftp may.

-- 
mathieu perrenoud

--
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] .bashrc over ssh

2003-12-10 Thread N. Owen Gunden
On Tue, Dec 09, 2003 at 08:34:36PM +0100, Oliver Lange wrote:
 Does anyone know how to use ssh in a way that ~/.bashrc is
 executed at logon ? Currently, I need to start a bash right
 after logging in, then must enter 'exit' twice to log off..

man bash
read the section INVOCATION

It will take 5-10 minutes, and I swear it will answer your questions
better than anyone on the list.

 - O

--
[EMAIL PROTECTED] mailing list



[gentoo-user] .bashrc over ssh

2003-12-09 Thread Oliver Lange
Hello everyone,

Does anyone know how to use ssh in a way that ~/.bashrc is
executed at logon ? Currently, I need to start a bash right
after logging in, then must enter 'exit' twice to log off..
--
[EMAIL PROTECTED] mailing list


Re: [gentoo-user] .bashrc over ssh

2003-12-09 Thread Ric Messier
What do you have set for your shell?

On Tue, 9 Dec 2003, Oliver Lange wrote:

 Hello everyone,
 
 Does anyone know how to use ssh in a way that ~/.bashrc is
 executed at logon ? Currently, I need to start a bash right
 after logging in, then must enter 'exit' twice to log off..
 

--
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] .bashrc over ssh

2003-12-09 Thread Eric Paynter
Oliver Lange said:
 Does anyone know how to use ssh in a way that ~/.bashrc is
 executed at logon ? Currently, I need to start a bash right
 after logging in, then must enter 'exit' twice to log off..

It probably runs ~/.bash_login on login. I've symlinked the two
files together, since I expect the same behaviour regarless of my
login method.

Also, a workaround to the double logout is to just source the
file. Run . ~/.bashrc (yes, that's a single dot followed by a
space and then your .bashrc) and it will execute ~/.bashrc without
causing a second login.

-Eric

-- 
arctic bears - email and name services
25 email [EMAIL PROTECTED] CA$11.95/month
DNS starting at CA$3.49/month - domains from CA$25.95/year
for details contact [EMAIL PROTECTED] or visit
http://www.arcticbears.com




--
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] .bashrc over ssh - bash tips

2003-12-09 Thread Sandy McArthur
Oliver Lange wrote:
Does anyone know how to use ssh in a way that ~/.bashrc is
executed at logon ? 
The exact details of when and why bash, or any other shell, sources 
files is beyond me but

Currently, I need to start a bash right after logging in, then must
enter 'exit' twice to log off..
If you run `exec bash` instead of `bash` the exec will exit the first 
shell as it forks the new shell saving you from having to exit two 
shells. Run `man bash` and seach for exec for details.

Also in un*x most everyhing is a file, including standard in. Also 
ctrl+d is usually the key combination to send an EOF which, unless 
your shell has ignoreeof set in the enviroment, will exit the shell, 
saving you a few key strokes.

Sandy McArthur

--
[EMAIL PROTECTED] mailing list


Re: [gentoo-user] .bashrc over ssh

2003-12-09 Thread mathieu perrenoud
 Does anyone know how to use ssh in a way that ~/.bashrc is
 executed at logon ? Currently, I need to start a bash right
 after logging in, then must enter 'exit' twice to log off..

I have all my init. scripts in ~/.scriptrc and I have it called by ~/.bashrc 
and ~/.bash_profile so it's called whether I use a login shell or not.

-- 
mathieu


--
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] .bashrc over ssh

2003-12-09 Thread Richard Kilgore
On Tue, Dec 09, 2003 at 02:48:30PM -0500, Ric Messier wrote:
 What do you have set for your shell?
 
 On Tue, 9 Dec 2003, Oliver Lange wrote:
 
  Hello everyone,
  
  Does anyone know how to use ssh in a way that ~/.bashrc is
  executed at logon ? Currently, I need to start a bash right
  after logging in, then must enter 'exit' twice to log off..

Try this:

ssh -t remhost bash -i

and maybe add -l for bash, too.

- richard

-- 
Richard Kilgore
[EMAIL PROTECTED]

--
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] .bashrc over ssh

2003-12-09 Thread brett holcomb
You could source ~/.bashrc from ~/.bash_profile.

On Tue, 09 Dec 2003 20:34:36 +0100
 Oliver Lange [EMAIL PROTECTED] wrote:
Hello everyone,

Does anyone know how to use ssh in a way that ~/.bashrc 
is
executed at logon ? Currently, I need to start a bash 
right
after logging in, then must enter 'exit' twice to log 
off..

--
[EMAIL PROTECTED] mailing list


--
[EMAIL PROTECTED] mailing list


Re: [gentoo-user] .bashrc over ssh

2003-12-09 Thread Oliver Lange
Ric Messier wrote:
What do you have set for your shell?

Sorry, i don't understand the question, but there are
so many (different!!) replies to my initial question
that i guess the answer is already there... i just got
to try them all :)
Amazing how many different solutions i've already seen.

--
[EMAIL PROTECTED] mailing list


Re: [gentoo-user] .bashrc over ssh

2003-12-09 Thread Eric Paynter

Oliver Lange said:
 Ric Messier wrote:
 What do you have set for your shell?

 Sorry, i don't understand the question

The shell is what you use to interact with the operating system. By
default in Gentoo you use bash. Common alternatives include sh, ksh,
csh, and many many more...

-Eric

-- 
arctic bears - email and name services
25 email [EMAIL PROTECTED] CA$11.95/month
DNS starting at CA$3.49/month - domains from CA$25.95/year
for details contact [EMAIL PROTECTED] or visit
http://www.arcticbears.com




--
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] .bashrc over ssh

2003-12-09 Thread Eric Paynter
Oliver Lange said:
 brett holcomb wrote:
 You could source ~/.bashrc from ~/.bash_profile.

 What ?

 Sorry, Linux is still a riddle for me. Could you explain that
 in - lets say - one or two more lines ? :)

When you initiate an interactive session, the shell chooses an
initialization script to run based on how you started the session.
If you use bash, it may run ~/.bashrc or ~/.bash_profile. The
suggestion was to have ~./bash_profile run ~/.bashrc, so that you
get the results of ~/.bashrc when you spawned a shell that would
normally only run ~/.bash_profile. Personally, I like my suggestion
better, which is to symlink one to the other. Since you are using
~/.bashrc, I would delete ~/.bash_profile and link ~/.bash to it.
Like this:

mv ~/.bash_profile ~/.bash_profile.bkp
ln -s ~/.bashrc ~/.bash_profile

Then you get the same thing, no matter how you started the shell.
Also, you can edit either file and the other gets the edits, since
they are really both the same file, just with two names. For me this
works since I'm not taking any action in those scripts that depends
on how I started the shell. For some people, how they start the
shell matters, so this won't work for them.

-Eric

-- 
arctic bears - email and name services
25 email [EMAIL PROTECTED] CA$11.95/month
DNS starting at CA$3.49/month - domains from CA$25.95/year
for details contact [EMAIL PROTECTED] or visit
http://www.arcticbears.com




--
[EMAIL PROTECTED] mailing list



Re: [gentoo-user] .bashrc over ssh

2003-12-09 Thread Ric Messier
On Tue, 9 Dec 2003, Eric Paynter wrote:

 
 When you initiate an interactive session, the shell chooses an
 initialization script to run based on how you started the session.
 If you use bash, it may run ~/.bashrc or ~/.bash_profile. 

Gentoo by default sources .bashrc from .bash_profile which is, of course, 
why I asked what shell he is using. If .bashrc isn't getting run, then 
perhaps he has a different shell without realizing it. 

The problem with symlinking one to the other as you suggest is if you ever 
use something like scp, you potentially break it, as the comment in 
.bashrc says. All my profile-ish things that generate output get put, 
correctly, into .bash_profile. Of course, if you never generate output 
with your login scripts then you're ok. Just something to keep in mind, 
though.

Ric

--
[EMAIL PROTECTED] mailing list