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

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. vue 高德地图

    index.html <link rel="stylesheet" href="http://cache.amap.com/lbs/static/main1119. ...

  2. 009-DNS域名解析系统

    一.概述 DNS是域名系统(DomainNameSystem)的缩写,该系统用于命名组织到域层次结构中的计算机和网络服务.域名是由圆点分开一串单词或缩写组成的,每一个域名都对应一个惟一的IP地址,在I ...

  3. labelme

    项目:https://github.com/wkentaro/labelme?tdsourcetag=s_pcqq_aiomsg 说明:https://www.bilibili.com/video/a ...

  4. nginx服务报错解决

    403禁止访问解决 . 重要:修改配置文件使用虚拟机,否则怎么配置都不生效,添加如下用户 [root@host---- html]# ll /etc/nginx/nginx.conf -rw-r--r ...

  5. 找回Firefox4的状态栏!Status-4-Evar扩展

    Status-4-Evar这个扩展能让Firefox4故意移除的状态栏给找回来!官方下载地址为:https://addons.mozilla.org/zh-CN/firefox/addon/23528 ...

  6. 通过route指令指定笔记本同时连接外网和内网

    假如你的外网网关是:X.X.X.X 内网网关:192.168.1.1 则在命令窗口输入以下两条命令: route add 0.0.0.0 mask 0.0.0.0 X.X.X.X route add ...

  7. iOS-调用网页聊天、拨打电话

    @property (nonatomic,strong) UIButton *but;@property (nonatomic,strong) UIButton *but1;@property (st ...

  8. Spring boot 新建项目pom.xml文件报错 Failure to transfer org.springframework.boot:spring-boot-maven-plugin

    新建项目依赖下载时网络中断导致资源损坏 删除.m2\repository中后缀名为lastUpdated的文件 cd %userprofile%\.m2\repository for /r %i in ...

  9. 初识 docker

    一.安装Docker 我使用的是腾讯云上的centos 7. docker -v 查看是否已经安装有docker 如果有 systemctl stop docker 停止docker服务 查看当前版本 ...

  10. oracle授予权限

    CONNECT角色:    --是授予最终用户的典型权利,最基本的 CREATE    SESSION    --建立会话 RESOURCE角色:    --是授予开发人员的    CREATE    ...