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

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 2014
Let'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)

 

相关文章:

  • 2021-12-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-25
  • 2021-07-26
  • 2022-12-23
  • 2021-12-08
  • 2021-04-29
  • 2022-12-23
  • 2021-12-18
相关资源
相似解决方案