查看当前日期以及登陆用户:
cat test1:
#!/bin/bash
# This script displays the date and who's logged on
echo -n The time and date are:
date
echo "Let's see who's logged into the system:"
who
添加执行权限:chmod u+x test1
执行./test1,得带结果如下:
The time and date are:Wed Oct :: CST
Let's see who's logged into the system:
clarck : -- : (:)
clarck pts/ -- : (:)
clarck pts/ -- : (:)