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

📄 sum-product.sh

📁 一本完整的描述Unix Shell 编程的工具书的所有范例
💻 SH
字号:
#!/bin/bash# sum-product.sh# A function may "return" more than one value.sum_and_product ()   # Calculates both sum and product of passed args.{  echo $(( $1 + $2 )) $(( $1 * $2 ))# Echoes to stdout each calculated value, separated by space.}echoecho "Enter first number "read firstechoecho "Enter second number "read secondechoretval=`sum_and_product $first $second`      # Assigns output of function.sum=`echo "$retval" | awk '{print $1}'`      # Assigns first field.product=`echo "$retval" | awk '{print $2}'`  # Assigns second field.echo "$first + $second = $sum"echo "$first * $second = $product"echoexit 0

⌨️ 快捷键说明

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