do_increment

来自「UNIX+shell范例精解(第4版)代码」· 代码 · 共 15 行

TXT
15
字号
#!/bin/bash# Scriptname: do_increment increment ()  {    local sum;     # sum is known only in this function    let "sum=$1 + 1"    return $sum    # Return the value of sum to the script} echo  -n "The sum is "increment 5    # Call function increment; pass 5 as a               # parameter; 5 becomes $1 for the increment               # functionecho $?        # The return value is stored in $?echo  $sum     # The variable "sum" is not known here

⌨️ 快捷键说明

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