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

📄 reexec.sh

📁 一个很好的SHELL的示例。可以对学习和深入学习SHELL的朋友。一点帮助。资料来自RED-HEAD 希望对大家有点帮助。
💻 SH
字号:
#! /bin/sh# Zsh is not Bourne compatible without the following:if test -n "$ZSH_VERSION"; then  emulate sh  NULLCMD=:fi# Bash is not POSIX compliant without the following:test -n "$BASH_VERSION" && set -o posixSHELL="${SHELL-/bin/sh}"if test x"$1" = x--re-executed; then  # Functional shell was found.  Remove option and continue  shiftelif "$SHELL" -c 'foo () { exit 0; }; foo' 2>/dev/null; then  # The current shell works already!  :else  # Try alternative shells that (sometimes) support functions  for cmd in sh bash ash bsh ksh zsh sh5; do    set `IFS=:; X="$PATH:/bin:/usr/bin:/usr/afsws/bin:/usr/ucb"; echo $X`    for dir      shell="$dir/$cmd"      if (test -f "$shell" || test -f "$shell.exe") &&        "$shell" -c 'foo () { exit 0; }; foo' 2>/dev/null      then        # Re-execute with discovered functional shell        SHELL="$shell" exec "$shell" "$0" --re-executed ${1+"$@"}      fi    done  done  echo "Unable to locate a shell interpreter with function support" >&2  exit 1fifoo () {    echo "$SHELL: ta da!"}fooexit 0

⌨️ 快捷键说明

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