#!/bin/bash
# Scriptname: do_square
function square {
local sq # sq is local to the function
let "sq=$1 * $1"
echo "Number to be squared is $1."
echo "The result is $sq "
}
echo "Give me a number to square. "
read number
value_returned=$(square $number) # Command substitution
echo "$value_returned"
阅读(293) | 评论(0) | 转发(0) |