⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 buggy3.sh

📁 Berkely的学生写的
💻 SH
字号:
#!/bin/sh# Chapter 20 - Debugging Shell Scripts# This script demonstrates using shell tracing to debug errors.# You should execute it as follows:##    /bin/sh -x ./buggy3.sh## in order to find the bug(s). You may also need to change /bin/echo# to /bin/echo -n to get the same output as shown in the book.Failed() {    if [ $1 -ne 0 ] ; then        echo "Failed. Exiting." ; exit 1 ;    fi    echo "Done."}YesNo() {    /bin/echo "$1 (y/n)? \c"    read RESPONSE    case $RESPONSE in        [yY]|[Yy][Ee][Ss]) RESPONSE=y ;;        [nN]|[Nn][Oo]) RESPONSE=n ;;    esac}YesNo "Make backup"if [ $RESPONSE = "y" ] ; then    /bin/echo "Deleting old backups, please wait... \c"    rm -fr backup > /dev/null 2>&1    Failed $?    /bin/echo "Making new backups, please wait... \c"    cp -r docs backup    Failed fi

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -