.bashrc in tty not active [SOLVED]

Forum rules
We don't support installations in VirtualBox, VMWare, qemu or others. We ignore posts about WINE, PlayOnLinux, Steam and Skype. We don't support btrfs, lvm, UEFI, side-by-side installations with GPT or dualboot with anything newer than Windows XP.
Google your problem first. Check the Wiki. Read the existing threads. It's okay to "hijack" an existing thread, yes! If your problem is not yet covered, open a new thread. To get the quickest possible help, mention the exact release codename in your post (uname -a is a good idea, too). Due to the lack of crystal balls, attach the output of lspci -nnk if you encounter hardware problems.
User avatar
wuxmedia
Grasshopper
Posts: 6454
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

.bashrc in tty not active [SOLVED]

Unread post by wuxmedia » Thu Jun 13, 2013 10:50 am

so i like to muck around in the tty (who doesn't) and i've noticed for a few releases the aliases don't work right away,

so i

Code: Select all

source .bashrc
and everythings normal.
is this normal - i thought it was read after (any) login?
terminal emulator in X works right away.
Last edited by wuxmedia on Sun Jun 30, 2013 7:40 am, edited 1 time in total.
"Seek, and Ye shall find"
"Github | Chooons | Site"

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: .bashrc in tty not active

Unread post by machinebacon » Fri Jun 14, 2013 6:09 am

Let's source it in ~./profile then, add:

Code: Select all

. /home/wux/.bashrc
to source the user's bashrc (you get the idea)
..gnutella..

User avatar
wuxmedia
Grasshopper
Posts: 6454
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: .bashrc in tty not active

Unread post by wuxmedia » Fri Jun 14, 2013 9:43 am

thats what i dont get;

Code: Select all

wuxmedia@asspire:~$ cat .profile 
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi
----
actually reading the comments .bashrc is -not- read because .bash_profile exists (to take us directly to startx, which i like)
so I guess i could delete .bash_profile, or maybe add the source to it.
OK i understand now
"Seek, and Ye shall find"
"Github | Chooons | Site"

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: .bashrc in tty not active

Unread post by machinebacon » Fri Jun 14, 2013 9:46 am

Yes, both should work as expected then.

The .profile file is good if you want to start an application without having xinit installed (for example CLIt starts tmux there, or Bloat starts the roastyourown script there, IIRC)
..gnutella..

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: .bashrc in tty not active

Unread post by rhowaldt » Fri Jun 14, 2013 10:44 am

@wux: it is not very...logical how all this works, is it :) (i never enjoyed the whole profile/bash_profile/bashrc-construction...)
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: .bashrc in tty not active

Unread post by machinebacon » Fri Jun 14, 2013 10:51 am

It makes sense if you consider that bash is not always the standard shell (sh or dash rather), so the .bash_profile is something that is preferred when bash is installed, and if not, then .profile is read. Makes sense once you have zsh as your default shell and notice how little impact .bash* on the whole construct has :D
..gnutella..

User avatar
wuxmedia
Grasshopper
Posts: 6454
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: .bashrc in tty not active

Unread post by wuxmedia » Fri Jun 14, 2013 11:29 am

i deleted .bash_profile.
thats works.

yeah, mostly switching to ZSH these days. is .profile read by zsh? or isn't it .zprofile.

on Boner i just dumped my aliases into .zshrc.local (even more confusing) and removed tmux from the one of the .bash things. when i su -, it goes to tmux 8)
it's kinda logical, just relies on a special logic, which i evidently dont have 8)
"Seek, and Ye shall find"
"Github | Chooons | Site"

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: .bashrc in tty not active

Unread post by machinebacon » Fri Jun 14, 2013 11:58 am

It's .zprofile, yes, and .bash_profile is ignored then. It does read, however, .profile, IIRC - though don't write me letters on this, I'm not 100% sure.
Some distros link /bin/sh to /bin/bash, and Ubuntu uses /bin/dash if I remember right.
..gnutella..

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: .bashrc in tty not active

Unread post by rhowaldt » Sun Jun 16, 2013 3:30 pm

@bacon: ah yes, i get it...it does make sense. i suppose i am a shell-racist... a shellist? completely forgot about the option for a different shell...
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

Post Reply