
問題:
インストールしましたが、コマンド ラインにsl
入力すると次のメッセージが表示されます:sl
bash: sl: command not found
(root@host)-(03:55:38)-(/home/user)
$apt install sl
Reading package lists... Done
Building dependency tree
Reading state information... Done
sl is already the newest version (3.03-17+b2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Sl は、誤って「sl」と入力した場合に訂正するためのアニメーションを表示できるプログラムです。SL は Steam Locomotive (蒸気機関車) の略です。 Debian パッケージのパッケージ
抜粋:
SL ソフトウェアをインストールして、蒸気機関車 (シェル内の列車) を入手します。
Debian
/Ubuntu Linuxで次の apt-get コマンド/apt コマンドを入力します。
$ sudo apt-get install sl
使用法
わかりました。ls コマンドを sl と誤って入力しました。
$ sl
(root@host)-(03:57:47)-(/home/user)
$cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
(root@host)-(04:04:01)-(/home/user)
$bash -version
GNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
質問:
ここで何が起こっているのか、機関車はどこにあるのか、何か設定する必要があるのか……?
答え1
として実行している場合root
(直接実行したのでそうだと思いますapt
)、の条件により、デフォルトではと がPATH
除外されます。/usr/local/games
/usr/games
/etc/profile
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi
export PATH
sl
たまたま にあります/usr/games
。