I have a working shell script that I would like to add as a command mein-befehl
referring to that post:
#!/bin/bash
original_string="$1"
string_to_replace_with='7'
result_string="${original_string/6/$string_to_replace_with}"
echo "$result_string"
so I have created the bin directory with
mkdir ~/bin
and placed my script file inside there. Then I have made it executable:
chmod +x ~/bin/mein-befehl
After that I have exportet the path:
export PATH=$PATH:~/bin
Updating by
sudo ~/.bashrc
returns the following issue to me:
sudo: /home/martin/.bashrc: command not found
running
~/.profile
is accepted.
So when I restart the terminal and type
mein-befehl "2016"
returns a command not found issue.
Question: I have followed exactly the steps mentioned in the post. Other sources online point out similiar things. What can I still have done wrong?
my $PATH
variable contains:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/martin/bin
export PATH=$PATH:~/bin
doesn't add to yourPATH
persistently unless you add it to your~/.bashrc
file. Also, yoursudo ./bashrc
step should probably have beensource ~/.bashrc
or. ~/.bashrc
– steeldriver Apr 27 '17 at 12:00