Shell命令判断文件或文件夹是否存在 2022-07-13 13:55 阅读 453 次 Shell命令判断文件或文件夹是否存在已关闭评论 Shell 1.判断$mul下ip文件夹是否存在,不存在则创建 if [ ! -d `echo $mul/ip/` ];thenmkdir $mul/ip/echo "ip文件夹不存在已创建"elseecho "ip文件夹...
Shell 整数比较大小 2022-07-12 19:52 阅读 205 次 Shell 整数比较大小已关闭评论 Shell 1.命令 -eq 等于 如:if [ "$a" -eq "$b" ] -ne 不等于 如:if [ "$a" -ne "$b" ] -gt ...
Shell中too many arguments错误的解决方法 2022-04-02 15:30 阅读 382 次 Shell中too many arguments错误的解决方法已关闭评论 Shell 原因: 中括号兼容问题 错误常出现在if语句中,可以直接将"[ ]"替换成"[[ ]]"就可以了 示例: if [ $version == 7 ];then 修改为 if [[ $version...
Shell格式化输出时间 2021-06-17 19:02 阅读 592 次 Shell格式化输出时间已关闭评论 Shell 1.命令 +%Y:年+%m:月+%d:日+%H:时+%M:分+%S:秒 2.示例: [[email protected]:41:29]~$ date +%y21[[email protected]:54:54]~$ date +%y%m2106[[email protected]:55:08]~$ d...
Centos根据系统版执行相应命令 2020-06-27 21:36 阅读 701 次 Centos根据系统版执行相应命令已关闭评论 Shell 本脚本适用Centos 6 和Centos 7 1.脚本 #!/bin/bashversion=`cat /etc/redhat-release|sed -r 's/.* ([0-9]+)\..*/\1/'` if [ $version == 6 ];t...
shc加密shell脚本 2018-10-13 17:35 阅读 1,378 次 shc加密shell脚本已关闭评论 Shell shc是一个加密shell脚本的工具.它的作用是把shell脚本转换为一个可执行的二进制文件. yum安装: yum -y install shc 编译安装: wget...