cow
以下にプログラムを配置し、追加して/opt
.bashrcを編集しました。
export PATH=“$PATH:/opt”
今$ PATHは/opt
cow
しかし、自分で実行したいとき
$ cow
The program 'cow' is currently not installed. You can install it by typing:
sudo apt-get install fl-cow
まだ走らなければなりません/opt/cow
何が問題なの?
ベストアンサー1
私が見るには間違ったタイプの引用符("")と("")を使用しているようです。
echo $PATH
/home/anon/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
sudo bash -c 'echo \$0 this is a test' >/opt/test.sh;sudo chmod +x /opt/test.sh
anon@masterbox:~$ export PATH=“$PATH:/opt”
anon@masterbox:~$ test.sh
bash: test.sh: command not found
anon@masterbox:~$ . .bashrc
anon@masterbox:~$ export PATH="$PATH:/opt"
anon@masterbox:~$ test.sh
/opt/test.sh this is a test
anon@masterbox:~$
編集:ここで問題をより明確にするために、私が望む方法で行うと何が起こるのかを確認してください。
$ echo $PATH
# this is correct
/home/anon/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
$ export PATH=“$PATH:/opt”
$ echo $PATH
# this is incorrect
“/home/anon/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/opt”
$
BashはこのようにPATH変数を正しく解釈できません。 Unicode引用符は、UNIXシステムではこのようには機能しません。これがあなたの質問に答えることを願っています。