I accidentally made a mistake when I changed my ~/.bash_profile
file and now I'm unable to run any command, such as ls
, touch
, sudo
, etc.
When I write echo $PATH
I have this result:
$ echo $PATH
/usr/local/bin:
$
And when I type /bin/cat ~/.bash_profile
, I have this result:
export PATH=$HOME/local/node/bin:/usr/local/bin:$PATH
export PATH=/usr/local/bin:$PATHh
But I am unable to change it. Can someone help me, please?
Sometimes when you try to use a command and Bash displays the "Command not found" error, it might be because the program is not installed on your system. Correct this by installing a software package containing the command.
$_ (dollar underscore) is another special bash parameter and used to reference the absolute file name of the shell or bash script which is being executed as specified in the argument list. This bash parameter is also used to hold the name of mail file while checking emails.
bash [filename] runs the commands saved in a file. $@ refers to all of a shell script's command-line arguments. $1 , $2 , etc., refer to the first command-line argument, the second command-line argument, etc. Place variables in quotes if the values might have spaces in them.
The echo command is used to display a line of text that is passed in as an argument. This is a bash command that is mostly used in shell scripts to output status to the screen or to a file.
If you can do /bin/cat
, you should be able to /usr/bin/vi
, too. Alternately, just fix it in your local shell:
PATH=/bin:/usr/bin:/sbin:/usr/sbin
And then running your favourite editor should work again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With