Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #243914 > unrolled thread

bashrc problem

Started byYamadaえりな <yamoerina@gmail.com>
First post2022-01-12 12:50 +0100
Last post2022-01-12 13:40 +0100
Articles 5 — 2 participants

Back to article view | Back to linux.debian.user


Contents

  bashrc problem Yamadaえりな <yamoerina@gmail.com> - 2022-01-12 12:50 +0100
    Re: bashrc problem Will Mengarini <seldon@eskimo.com> - 2022-01-12 13:20 +0100
      Re: bashrc problem Yamadaえりな <yamoerina@gmail.com> - 2022-01-12 13:20 +0100
        Re: bashrc problem Will Mengarini <seldon@eskimo.com> - 2022-01-12 13:30 +0100
          Re: bashrc problem Yamadaえりな <yamoerina@gmail.com> - 2022-01-12 13:40 +0100

#243914 — bashrc problem

FromYamadaえりな <yamoerina@gmail.com>
Date2022-01-12 12:50 +0100
Subjectbashrc problem
Message-ID<DEKiB-8bM-1@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

Hello list

I have a .bashrc file in my home dir, whose content is shown as follows.

But every time I log into the system, I have to source this file by hand.

$ which scala
/usr/bin/scala

$ cat .bashrc
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source
"$HOME/.sdkman/bin/sdkman-init.sh"

$ . .bashrc
$ which scala
/home/xxx/.sdkman/candidates/scala/current/bin/scala


How can I make it take effect automatically after I login the system?

ありがとう
Yamada

[toc] | [next] | [standalone]


#243915

FromWill Mengarini <seldon@eskimo.com>
Date2022-01-12 13:20 +0100
Message-ID<DEKLE-9m-3@gated-at.bofh.it>
In reply to#243914
* Yamada??? <yamoerina@gmail.com> [22-01/12=We 19:49 +0800]:
> I have a .bashrc file in my home dir, whose content is shown as follows.
> But every time I log into the system, I have to source this file by hand.
> 
> $ which scala
> /usr/bin/scala
> 
> $ cat .bashrc
> #THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
> export SDKMAN_DIR="$HOME/.sdkman"
> [[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source \
>   "$HOME/.sdkman/bin/sdkman-init.sh"
> 
> $ . .bashrc
> $ which scala
> /home/xxx/.sdkman/candidates/scala/current/bin/scala
> 
> How can I make it take effect automatically after I login the system?

Check whether you have either ~/.bash_profile or ~/.profile.

If ~/.bash_profile, the line
  . ~/.bashrc
will suffice.

If ~/.profile, use
  # if running bash
  if [ -n "$BASH_VERSION" ]; then
      # include .bashrc if it exists
      if [ -f ~/.bashrc ]; then
          . ~/.bashrc
      fi
  fi
in case you someday want to try other shells.

[toc] | [prev] | [next] | [standalone]


#243916

FromYamadaえりな <yamoerina@gmail.com>
Date2022-01-12 13:20 +0100
Message-ID<DEKLE-9m-7@gated-at.bofh.it>
In reply to#243915

[Multipart message — attachments visible in raw view] — view raw

Do you mean if .bash_profile exists, .bashrc will be ignored?

Thanks.

On Wed, Jan 12, 2022 at 8:07 PM Will Mengarini <seldon@eskimo.com> wrote:

> * Yamada??? <yamoerina@gmail.com> [22-01/12=We 19:49 +0800]:
> > I have a .bashrc file in my home dir, whose content is shown as follows.
> > But every time I log into the system, I have to source this file by hand.
> >
> > $ which scala
> > /usr/bin/scala
> >
> > $ cat .bashrc
> > #THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
> > export SDKMAN_DIR="$HOME/.sdkman"
> > [[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source \
> >   "$HOME/.sdkman/bin/sdkman-init.sh"
> >
> > $ . .bashrc
> > $ which scala
> > /home/xxx/.sdkman/candidates/scala/current/bin/scala
> >
> > How can I make it take effect automatically after I login the system?
>
> Check whether you have either ~/.bash_profile or ~/.profile.
>
> If ~/.bash_profile, the line
>   . ~/.bashrc
> will suffice.
>
> If ~/.profile, use
>   # if running bash
>   if [ -n "$BASH_VERSION" ]; then
>       # include .bashrc if it exists
>       if [ -f ~/.bashrc ]; then
>           . ~/.bashrc
>       fi
>   fi
> in case you someday want to try other shells.
>

[toc] | [prev] | [next] | [standalone]


#243918

FromWill Mengarini <seldon@eskimo.com>
Date2022-01-12 13:30 +0100
Message-ID<DEKVj-cB-7@gated-at.bofh.it>
In reply to#243916
* Yamada??? <yamoerina@gmail.com> [22-01/12=We 20:10 +0800]:
> Do you mean if .bash_profile exists, .bashrc will be ignored?

Sometimes.  From `man bash`:
  When bash is invoked as an interactive login shell, or as a
  non-interactive shell with the --login option, it first reads
  and executes commands from the file /etc/profile, if that file
  exists.  After reading that file, it looks for ~/.bash_profile,
  ~/.bash_login, and ~/.profile, in that order, and reads and
  executes commands from the first one that exists and is readable.
  [...]
  When an interactive shell that is not a login shell
  is started, bash reads and executes commands from
  /etc/bash.bashrc and ~/.bashrc, if these files exist.

* Yamada??? <yamoerina@gmail.com> [22-01/12=We 19:49 +0800]:
>>> I have a .bashrc file in my home dir, whose content is shown as follows.
>>> But every time I log into the system, I have to source this file by hand.
>>>
>>> $ which scala
>>> /usr/bin/scala
>>>
>>> $ cat .bashrc
>>> #THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
>>> export SDKMAN_DIR="$HOME/.sdkman"
>>> [[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source \
>>>   "$HOME/.sdkman/bin/sdkman-init.sh"
>>>
>>> $ . .bashrc
>>> $ which scala
>>> /home/xxx/.sdkman/candidates/scala/current/bin/scala
>>>
>>> How can I make it take effect automatically after I login the system?

On Wed, Jan 12, 2022 at 8:07 PM Will Mengarini <seldon@eskimo.com> wrote:
>>
>> Check whether you have either ~/.bash_profile or ~/.profile.
>>
>> If ~/.bash_profile, the line
>>   . ~/.bashrc
>> will suffice.
>>
>> If ~/.profile, use
>>   # if running bash
>>   if [ -n "$BASH_VERSION" ]; then
>>       # include .bashrc if it exists
>>       if [ -f ~/.bashrc ]; then
>>           . ~/.bashrc
>>       fi
>>   fi
>> in case you someday want to try other shells.

[toc] | [prev] | [next] | [standalone]


#243919

FromYamadaえりな <yamoerina@gmail.com>
Date2022-01-12 13:40 +0100
Message-ID<DEL4Z-fH-1@gated-at.bofh.it>
In reply to#243918

[Multipart message — attachments visible in raw view] — view raw

Thanks a lot @Will Mengarini <seldon@eskimo.com>

On Wed, Jan 12, 2022 at 8:21 PM Will Mengarini <seldon@eskimo.com> wrote:

> * Yamada??? <yamoerina@gmail.com> [22-01/12=We 20:10 +0800]:
> > Do you mean if .bash_profile exists, .bashrc will be ignored?
>
> Sometimes.  From `man bash`:
>   When bash is invoked as an interactive login shell, or as a
>   non-interactive shell with the --login option, it first reads
>   and executes commands from the file /etc/profile, if that file
>   exists.  After reading that file, it looks for ~/.bash_profile,
>   ~/.bash_login, and ~/.profile, in that order, and reads and
>   executes commands from the first one that exists and is readable.
>   [...]
>   When an interactive shell that is not a login shell
>   is started, bash reads and executes commands from
>   /etc/bash.bashrc and ~/.bashrc, if these files exist.
>
> * Yamada??? <yamoerina@gmail.com> [22-01/12=We 19:49 +0800]:
> >>> I have a .bashrc file in my home dir, whose content is shown as
> follows.
> >>> But every time I log into the system, I have to source this file by
> hand.
> >>>
> >>> $ which scala
> >>> /usr/bin/scala
> >>>
> >>> $ cat .bashrc
> >>> #THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
> >>> export SDKMAN_DIR="$HOME/.sdkman"
> >>> [[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source \
> >>>   "$HOME/.sdkman/bin/sdkman-init.sh"
> >>>
> >>> $ . .bashrc
> >>> $ which scala
> >>> /home/xxx/.sdkman/candidates/scala/current/bin/scala
> >>>
> >>> How can I make it take effect automatically after I login the system?
>
> On Wed, Jan 12, 2022 at 8:07 PM Will Mengarini <seldon@eskimo.com> wrote:
> >>
> >> Check whether you have either ~/.bash_profile or ~/.profile.
> >>
> >> If ~/.bash_profile, the line
> >>   . ~/.bashrc
> >> will suffice.
> >>
> >> If ~/.profile, use
> >>   # if running bash
> >>   if [ -n "$BASH_VERSION" ]; then
> >>       # include .bashrc if it exists
> >>       if [ -f ~/.bashrc ]; then
> >>           . ~/.bashrc
> >>       fi
> >>   fi
> >> in case you someday want to try other shells.
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web