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

📄 ex64.sh

📁 一本完整的描述Unix Shell 编程的工具书的所有范例
💻 SH
字号:
#!/bin/bash# "and list"if [ ! -z "$1" ] && echo "Argument #1 = $1" && [ ! -z "$2" ] && echo "Argument #2 = $2"then  echo "At least 2 arguments passed to script."  # All the chained commands return true.else  echo "Less than 2 arguments passed to script."  # At least one of the chained commands returns false.fi  # Note that "if [ ! -z $1 ]" works, but its supposed equivalent,#   if [ -n $1 ] does not.#     However, quoting fixes this.#  if [ -n "$1" ] works.#     Careful!# It is always best to QUOTE tested variables.# This accomplishes the same thing, using "pure" if/then statements.if [ ! -z "$1" ]then  echo "Argument #1 = $1"fiif [ ! -z "$2" ]then  echo "Argument #2 = $2"  echo "At least 2 arguments passed to script."else  echo "Less than 2 arguments passed to script."fi# It's longer and less elegant than using an "and list".exit 0

⌨️ 快捷键说明

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