UNIXでは、シェルスクリプトを/ usr / local / binに移動すると、「[scriptname] .sh」と入力してEnterキーを押すだけで、任意の場所からスクリプトを実行できるようになることを読みました。
通常のユーザー権限とroot権限の両方でスクリプトを移動しましたが、実行できません。
スクリプト:
#! bin/bash
echo "The current date and time is:"
date
echo "The total system uptime is"
uptime
echo "The users currently logged in are:"
who
echo "The current user is:"
who -m
exit 0
これは、移動してスクリプトを実行しようとするとどうなるかです。
[myusername@VDDK13C-6DDE885 ~]$ sudo mv sysinfo.sh /usr/local/bin
[myusername@VDDK13C-6DDE885 ~]$ sysinfo.sh
bash: sysinfo.sh: command not found