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

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/ -- : (:)

bash shell脚本之查看当前日期以及登陆用户的更多相关文章

  1. bash shell脚本之查看系统环境变量

    查看当前系统环境变量 cat test2: #!/bin/bash # display user information from the system. echo "User info f ...

  2. 系统管理中 bash shell 脚本常用方法总结

    在日常系统管理工作中,需要编写脚本来完成特定的功能,编写shell脚本是一个基本功了!在编写的过程中,掌握一些常用的技巧和语法就可以完成大部分功能了,也就是2/8原则 1. 单引号和双引号的区别 单引 ...

  3. Linux Shell——bash shell 脚本简介

    bash shell 脚本简介 shell 运行环境 如果你运行的是 Unix 或 Linux 系统,例如 Ubuntu,Red Hat,SUSE Linux,还有macOS,都是内置了 bash s ...

  4. java 调用bash shell脚本阻塞的小问题的解决

    java  调用bash shell脚本阻塞的小问题的解决 背景 使用java实现的web端,web端相应用户的界面操作,使用java调用bash实现的shell脚本进行实际的操作,操作完成返回执行结 ...

  5. shell脚本配置ssh免密登陆

    通过shell脚本配置免密登陆,分为两个脚本,一个是配置文件config.env,一个是正式脚本sshkey.sh. # config.envexport HOST_USER=(root) expor ...

  6. Linux bash shell脚本语法入门

    1.基础 #!/bin/bash   //bash脚本第一句都是这个,他会让系统指定以bash来解释这个脚本 #                 //shell脚本注释符号 2.变量和使用 HOME= ...

  7. (转)Linux bash shell脚本语法入门

    http://www.linuxsky.org/doc/newbie/201004/389.html 1.基础 #!/bin/bash //bash脚本第一句都是这个,他会让系统指定以bash来解释这 ...

  8. Linux编程 3 (初识bash shell与man查看手册)

    一.初识bash shell 1.1 启动 shell   GNU bash shell 能提供对Linux系统的交互式访问.通常是在用户登录终端时启动,登录时系统启动shell依赖于用户账户的配置. ...

  9. shell脚本事例 -- 获取当前日期的前一天日期

    记录一个shell脚本事例,事例中包括shell的一些语法(函数定义.表达式运算.if.case...) #!/bin/sh #获取当前时间 RUN_TIME=`date +%H%M%S` #取当前日 ...

随机推荐

  1. 机器阅读理解综述Neural Machine Reading Comprehension Methods and Trends(略读笔记)

    标题:Neural Machine Reading Comprehension: Methods and Trends 作者:Shanshan Liu, Xin Zhang, Sheng Zhang, ...

  2. cv2.bitwise_and的应用,

    import cv2 import numpy as np Load two images img1 = cv2.imread('messi.png') img2 = cv2.imread('logo ...

  3. SpringBoot 2.x中为tomcat配置ssl(https)支持

    参考来源:https://www.cnblogs.com/imfjj/p/9058443.html https://blog.csdn.net/jackymvc/article/details/810 ...

  4. centos7用yum安装node.js v8.x

    1.更新node.js v8.x yum源 // 不更新,提示没有 packages文件 # curl --silent --location https://rpm.nodesource.com/s ...

  5. python基础----pymysql模块

    安装pymysql   ----pip install mysql 步骤: 1.建立连接   指定ip.端口号.密码.账号.数据库 2.建立游标 3.执行sql语句 4.获取结果或提交 5.关闭游标, ...

  6. Eureka报错: Connect to localhost:8761 timed out

    最近整理配置Eureka时, 注册服务后, Eureka服务一直报出如下错误: 如下是我的单台eureka的 application.yml 配置: spring: application: name ...

  7. CodeForces 1251A --- Broken Keyboard

    [CodeForces 1251A --- Broken Keyboard ] Description Recently Polycarp noticed that some of the butto ...

  8. 《Java语言程序设计》继承与多态

    一.动手实验:继承条件下的构造方法 调用运行 TestInherits.java 示例,观察输出,注意总结父类与子类之间构造方法的调用关系修改Parent构造方法的代码,显式调用GrandParent ...

  9. OpenCV.物体识别

    1.度娘:“OpenCV 物体识别” 1.1.opencv实时识别指定物体 - 诺花雨的博客 - CSDN博客.html(https://blog.csdn.net/qq_27063119/artic ...

  10. Websocket基础梳理

    Websocket原理: websocket介绍: WebSocket(http://dev.w3.org/html5/websockets)是HTML5规范(http://www.w3.org/TR ...