bash shell脚本之查看当前日期以及登陆用户

来源:互联网 发布:藏文输入法软件下载 编辑:程序博客网 时间:2024/05/18 01:29

查看当前日期以及登陆用户:

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 15 20:54:48 CST 2014Let's see who's logged into the system:clarck   :0           2014-10-14 16:20 (:0)clarck   pts/1        2014-10-15 17:56 (:0)clarck   pts/4        2014-10-15 20:50 (:0)


0 0
原创粉丝点击