Shell脚本进阶 Linux系统启动流程 Linux内核编译

本文涵盖了使用Shell脚本实现Linux自动登录机器的方法,探讨了如何在数组中判断值是否存在,以及将MAC地址转换格式的命令和脚本。此外,文章还详细介绍了CentOS7的开机流程,并指导编写Nginx的systemd配置以实现开机启动。
摘要由CSDN通过智能技术生成

1、用shell脚本实现自动登录机器

#!/usr/bin/expect

#!/usr/bin/expect
set ip [lindex $argv 0]
set user [lindex $argv 1]
set password [lindex $argv 2]
set timeout 15                                                                            
spawn ssh $user@$ip
expect {
        "yes/no" { send "yes\n";exp_continue }
        "password" { send "$password\n" }
}
interact

#!/bin/bash 可以登录 但是登录后自动退出

#!/bin/bash
ip=$1
user=$2
password=$3
expect <<EOF
set timeout 15
spawn ssh $user@$ip
expect {
"yes/no" { send "yes\n";exp_continue }
"password" { send "$password\n" }
}
expect eof
EOF

2、shell 判断一个值bone是否在数组arrayZ=( one two three four five five )中

#!/bin/bash
declare -a arrayZ
arrayZ=( one two three four five 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值