linux-tutorial/codes/shell/示例脚本/脚本函数/使用函数输出.sh

13 lines
173 B
Bash
Raw Normal View History

2019-05-10 11:17:57 +08:00
#!/bin/bash
2019-10-10 08:56:31 +08:00
2019-05-10 11:17:57 +08:00
# using the echo to return a value
function db1 {
2019-10-10 08:56:31 +08:00
read -p "Enter a value:" value
echo $[ $value * 2 ]
2019-05-10 11:17:57 +08:00
}
result=`db1`
echo "The new value is $result"