Ubuntu – bash: /home/rathin/.profile:: No such file or directory while trying to reload it via “source ~/.profile” after editing it through “vi ~/.profile”

bashprofile

After I edited my ~/.profile via vi command, couldn't get out of it successfully.

So I closed the terminal and when I tried it again after reopening terminal, it showed duplicate file named ~/.profile.swp. So I deleted it.

Now it shows

bash: /home/rathin/.profile:: No such file or directory

when I try

source ~/.profile

It also shows error

Error loading /home/user/.profile no such file or directory found.

when I restart my laptop.

This is the output of vi ~/.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

"~/.profile" 25 lines, 677 characters

Any help will be much appreciated.

Best Answer

Get rid of the first line in that file. It reads

~/.profile: ...

and bash tries to execute this file, the name of which ends with a :. That file does not exist, so bash complains, note the double: in the error messsge.

Related Question