После того, как я отредактировал команду ~/.profile с помощью команды vi, не смог успешно выйти из нее.
Итак, я закрыл терминал, и когда я попробовал его снова после повторного открытия терминала, он показал дубликат файл с именем ~/.profile.swp.
Теперь он показывает
bash: /home/rathin/.profile:: No such file or directory
, когда я пытаюсь
source ~/.profile
Он также показывает ошибку
Error loading /home/user/.profile no such file or directory found.
, когда я перезагружаю свой ноутбук.
Это результат работы 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
Любая помощь будет высоко оценена.
TL; DR Первая строка должна быть комментарием
# ~/.profile: executed by the command interpreter for login shells.
Поэтому запустите
perl -i.bak -0777 -pe 's/^/# /' ~/.profile
Команда добавляет # в начало первой строки и создает файл резервной копии: ~/.profile.bak
Объяснение
-0777 изменяет разделитель строк на undef, позволяя нам slurp файл, подавая все линии на Perl за один раз. -p обрабатывает файл по строкам и печатает вывод. -e - это то, что позволяет нам указать код Perl, который мы хотим запустить прямо в командной строке.