随笔分类 -  Shell

摘要:场景:让用户输入 yes 再执行下一步 read -p "Please type 'yes' to continue: " input if [ "$input" != "yes" ]; then echo "You did not enter 'yes'. Exit..." exit 1 fi 阅读全文
posted @ 2024-04-25 23:29 op-timistic 阅读(189) 评论(0) 推荐(0)
摘要:#!/usr/bin/env bash set -xeuo pipefail # 需要以 root 运行,或者 sudo if [ `id -u` -ne 0 ] then echo Please run this script as root or using sudo! exit fi User 阅读全文
posted @ 2024-04-25 23:24 op-timistic 阅读(160) 评论(0) 推荐(0)