bash shell 编程练习一

本文介绍了一个实用的Shell脚本,该脚本包含了多个基本的系统管理和查询命令,如显示当前用户、显示日期、列出根目录文件等。通过这些命令可以帮助用户快速了解系统的状态。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


#!/bin/bash
#Auther name : XJ C
# 1)say welcom to users;2)show date;3)show our mashine name;4)show the system's name and version;5)show all the listed file in the root dictory;6)show all runnig processes;7)show the value of the TERM,PATH and HOME;8)show the conditon of the disk;9)print the ID of your group using" id ";10)say "Good Bye" and tell him the time.
echo "***********1)*************"
user=`whoami` # NO space befor or after =!
case $user in 
vagrant)
   echo "hello vagrant";;
xj)  
   echo "hello xj";;
esac
echo "******2)****************"
date "+%Y-%m-%d %T"
echo "*****************"
cal 
echo "******3)***********"
hostname
echo "*********4)***********"
uname -svr
echo "**********5)********"
ls ../
echo "**********6)********"
ps -u root 
echo  "**********7)*******"
echo "Path:$PATH;Term:$TERM;Home:$HOME"
echo "*************8)**********"
df -h -T
echo "***************9)*********"
id -g
echo "*********10)****************"
echo "Good bye +`date "+%Y-%m-%d %T"`"



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值