shell中变量引用问题
fdisk-l2>/dev/null|grep-o"Disk/dev/[sh]d[a-z]"read-p"yourchoice:"PARTDISKif[$PARTDISK...
fdisk -l 2> /dev/null | grep -o "Disk /dev/[sh]d[a-z]"
read -p "your choice: " PARTDISK
if [ $PARTDISK == 'quit' ];then
echo "quit"
exit 7
fi
until fdisk -l 2> /dev/null | grep -o "^Disk /dev/[sh]d[a-z]" | grep "Disk $PARTDISK$" &> /dev/null;do
read -p "wrong option,your choice again: " CHOICE
done
在
until fdisk -l 2> /dev/null | grep -o "^Disk /dev/[sh]d[a-z]" | grep "Disk $PARTDISK$" &> /dev/null;do
read -p "wrong option,your choice again: " CHOICE
done
段中,为什么 $PARTDISK$,而不是 $PARTDISK,用 $PARTDISK就过滤不出来 展开
read -p "your choice: " PARTDISK
if [ $PARTDISK == 'quit' ];then
echo "quit"
exit 7
fi
until fdisk -l 2> /dev/null | grep -o "^Disk /dev/[sh]d[a-z]" | grep "Disk $PARTDISK$" &> /dev/null;do
read -p "wrong option,your choice again: " CHOICE
done
在
until fdisk -l 2> /dev/null | grep -o "^Disk /dev/[sh]d[a-z]" | grep "Disk $PARTDISK$" &> /dev/null;do
read -p "wrong option,your choice again: " CHOICE
done
段中,为什么 $PARTDISK$,而不是 $PARTDISK,用 $PARTDISK就过滤不出来 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询