[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [solved] Re: Setting up aliases to work also in tty* consoles?



Greg Wooledge <wooledg@eeg.ccf.org> writes:

> On Tue, Jun 20, 2017 at 05:32:09PM +0100, Rodolfo Medina wrote:
>> Greg Wooledge <wooledg@eeg.ccf.org> writes:
>> > Once more, from the top:
>> >
>> > 1) ~/.bash_profile should source ~/.bashrc
>> > 2) Shell functions and aliases and shopts and sets and other transient
>> >    settings should go in ~/.bashrc
>> > 3) Environment variables and other NON-transient settings should go in
>> >    ~/.bash_profile
>
>> My alias:
>> 
>>  alias mplayer='mplayer -demuxer lavf'
>> 
>> works, for tty* consoles, if I put it in ~/.bash_profile.  Instead, if I put
>> it in ~/.bashrc, it doesn't work within tty* but only within graphical
>> system.
>
> Refer to step 1.  Make sure ~/.bash_profile sources ~/.bashrc.
>
> Debian provides a ~/.profile by default in jessie and stretch, so
> ~/.bash_profile is either something you wrote, or something you
> inherited from an older system.
>
> Make ~/.bash_profile source ~/.bashrc.
>
> If you need help with that, you can paste the code from /etc/skel/.profile
> starting with "# if running bash" and ending with the second "fi" line
> which follows that comment.
>
> ~/.bash_profile must source ~/.bashrc


Sorry, at the beginning I hadn't given enough importance to your recommendation
that ~/.bash_profile should source ~/.bashrc.  Now I put my alias in ~/bashrc,
then at the beginning of ~/.bash_profile I put:

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

and everything is fine: the alias is also active in tty* consoles.  I hope now
I understood and did correctly.

Thanks, Regards

Rodolfo


Reply to: