bash 是一个 shell 环境
PS1
# for user PS1='\[\e[94m\][\A] \[\e[93m\][\u\[\e[96m\]@\h\[\e[36m\]] \[\e[35m\][\[\e[95m\]$(ip route get 1.1.1.1 | awk -F"src " '"'"'NR == 1{ split($2, a," ");print a[1]}'"'"')\[\e[35m\]] \[\e[33m\][\w]\n\[\e[90m\]$? \[\e[32m\][ \$ > \[\e[93m\]'
# for root PS1='\[\e[94m\][\A] \[\e[93m\][\u\[\e[96m\]@\h\[\e[36m\]] \[\e[35m\][\[\e[95m\]$(ip route get 1.1.1.1 | awk -F"src " '"'"'NR == 1{ split($2, a," ");print a[1]}'"'"')\[\e[35m\]] \[\e[33m\][\w]\n\[\e[90m\]$? \[\e[31m\][ \$ > \[\e[93m\]'
rand pass generator
echo $(tr -dc 'A-Za-z0-9!@#$%*' < /dev/urandom | head -c 16)
getopt
OPTIONS_temp=$(getopt -o vhcpf: --long verbose,help,cron,plain,file: -- $1 ) if [ $? -ne 0 ]; then echo "Failed to parse options." exit 1 fi eval set -- "$OPTIONS_temp" while true; do case "$1" in -v | --verbose) VERBOSE=1 shift ;; -h | --help) HELP=1 shift ;; -p | --plain) no_colour=true shift ;; -c | --cron) cron=true shift ;; -f | --file) FILE=$1 shift 2 ;; --) shift break ;; *) break ;; esac done