#!/bin/bash
show_week()
{
for day in Monday Tuesday Wednesday Thursday Friday Saturday Sunday
do
echo "$day "
done
}
show_number()
{
for (( i = 1; i <= 7; i++ ))
do
echo -e "$i
"
done
}
show_square ()
{
j=0
until [[ "$j" -gt 7 ]]
do
let "square=j*j"
echo -e "$j*$j = $square
"
let "j++"
done
}
show_week
show_number
show_square
如上三个函数依次调用执行
输出如下: