#!/bin/bash echo "xkw" "myfirstshell" "晚上作业" var1=hello var2=`whoami` echo "${var1} ${var2}" echo `hostname` echo `ls ..` echo `ps -ajx | grep "root"` echo $PATH echo $HOME df /dev/sda1 id -g ${var2} echo "good bye"
#! /bin/bash echo "etc文件下文件个数:`ls -l /etc | grep "^d" | wc -l`" echo "etc文件下一级子目录个数:`ls -l /etc | grep "^-" | wc -l`" echo "var文件下文件个数:`ls -l /usr | grep "^d" | wc -l`" echo "var文件下一级子目录个数:`ls -l /usr | grep "^-" | wc -l`" echo "usr文件下文件个数:`ls -l /usr | grep "^d" | wc -l`" echo "usr文件下一级子目录个数:`ls -l /usr | grep "^-" | wc -l`"
#!/bin/bash var1=`whoami` echo $var1 id $var1 pwd
#!/bin/bash arr1=(`ls /etc/ | grep "^p" -i`) echo ${#arr1[*]}
#!/bin/bash read -p "输入文件名" filename if [ -f $filename ] then echo "普通文件" else echo "不是普通文件" fi
c 高级(shell指令)
于 2023-05-11 19:46:55 首次发布