#!/bin/bash ##磁盘数量 Disk=$( fdisk -l |grep 'Disk' |grep 'sd' |awk -F , '{print "%s",substr($1,13,1)}') var=${Disk: -1:1} echo blacklist{ >> /etc/multipath.conf echo devnode "^sd[a-${var}]$" >> /etc/multipath.conf echo devnode "^sd[a-${var}][1-9]$"} >> /etc/multipath.conf
并写道配置文件中。windows下bash容易出现编码错误问题,弄了半天…………………………………………………………………………………………………………………………………………………………………………………………………………