ex22a.sh
来自「一本完整的描述Unix Shell 编程的工具书的所有范例」· Shell 代码 · 共 22 行
SH
22 行
#!/bin/bash# Planets revisited.# Associate the name of each planet with its distance from the sun.for planet in "Mercury 36" "Venus 67" "Earth 93" "Mars 142" "Jupiter 483"do set -- $planet # Parses variable "planet" and sets positional parameters. # the "--" prevents nasty surprises if $planet is null or begins with a dash. # May need to save original positional parameters, since they get overwritten. # One way of doing this is to use an array, # original_params=("$@") echo "$1 $2,000,000 miles from the sun" #-------two tabs---concatenate zeroes onto parameter $2done# (Thanks, S.C., for additional clarification.)exit 0
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?