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

📄 recurse.sh

📁 Shall高级编程
💻 SH
字号:
#!/bin/bash# recurse.sh#  Can a script recursively call itself?#  Yes, but is this of any practical use?#  (See the following.)RANGE=10MAXVAL=9i=$RANDOMlet "i %= $RANGE"  # Generate a random number between 0 and $RANGE - 1.if [ "$i" -lt "$MAXVAL" ]then  echo "i = $i"  ./$0             #  Script recursively spawns a new instance of itself.fi                 #  Each child script does the same, until                   #+ a generated $i equals $MAXVAL.#  Using a "while" loop instead of an "if/then" test causes problems.#  Explain why.exit 0# Note:# ----# This script must have execute permission for it to work properly.# This is the case even if it is invoked by an "sh" command.# Explain why.

⌨️ 快捷键说明

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