当前位置:首页 > 虚拟机 > 正文

虚拟机怎样编写脚本文件


一、在虚拟机下编写三个shell脚本

1

#!/bin/bash
[$#-ne1]&&echo"用法:$0文件名"&&exit-1
read-p"entercount:"count
i=1
while[$i-le$count]
do
date=`date-d"$i天"+"%Y%m%d"`
$1_${date}
i=$(($i+1))
完成

2

#!/bin/bash
if[$#-ne1];然后
echo"usage:$0file1"
exit-1
fi
if[-e$1];then
now=`date+"%Y%m%d%H%M%S"`
 mv$1$1_${现在}
fi
awk-F':''{print$1}'/etc/passwd|.grept>$1

3.确保和格式正确?

:

user:passwd:UID:GID::/home/user:/bin/bash

:

user:newpasswd

#!/bin/bash
if[$#-ne2];then
echo"usage:$0user_filepasswd_file"
exit-1
fi
read-p"inputaction[add/del]:"act
case$actin
"add")
newusers$1
cat$2|.chpasswd
 ;;
 "del")
                                                                                                                                                                                                   
      已完成
    ;;
   *)“错误标志”;;
esac


二、虚拟机gg修改器找不到脚本1)选择流程后(流程无需详细描述),点击右侧三栏按钮。2)向下滑动一段距离,您将看到运行脚本按钮。3)单击此按钮选择所需的进程。运行脚本4)点击后我们需要这个脚本。不过,这要视情况而定。在这个页面找到脚本后,点击该脚本,然后运行秒杀链。