1

I am using Windows Subsystem for Linux, with ubuntu 16, when I go to my cmd line and type bash it logs in to bash:

enter image description here

typed bash

enter image description here

under my mnt/c/Users/natec/bashrc$ I have in the file

~/.bashrc

But my profile isn't being loaded, so I have to type bash again for it to load, how can I make it load ~/.bashrc by default?

4
  • My mistake, I meant ubuntu 16, I've updated OP.
    – Filtration
    Commented Aug 26, 2018 at 19:01
  • What version of windows 10; Bash indicates your using a legacy WSL instance
    – Ramhound
    Commented Aug 26, 2018 at 19:36
  • version 17134..
    – Filtration
    Commented Aug 26, 2018 at 19:37
  • This is the only one I've used, it did work, but all of a sudden it's doing this.
    – Filtration
    Commented Aug 26, 2018 at 20:38

2 Answers 2

0

Maybe the problem was with the .profile file:

The same problem has happened to me. After reinstalling the distro, I've ended up with a "refreshed" .profile, then made a comparison with a backed up copy. I've realized something interesting:

The old .profile:

eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

The new .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

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

As you can see, there is a conditional at the new one that the old onde haven't :

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

You could try to check your actual .profile and see if it's the case.

-1

seems like you're in the '/mnt' directory. This is for accessing windows files while using wsl. Try editing your .bashrc file in '/home/(username)' directory.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .