#!/bin/bash Function addem { If [ $# -eq 0 ] || [ $# -gt 2 ] then echo -1 elif [ $# -eq 1 ] then echo $[ $1 + $1 ] else echo $[ $1 + $2 ] fi } echo –n “adding 10 and 15:” value=$(addem 10 15) echo $value
Standard input is empty
Function addem { If [ $# -eq 0 ] || [ $# -gt 2 ] then echo -1 elif [ $# -eq 1 ] then echo $[ $1 + $1 ] else echo $[ $1 + $2 ] fi } echo –n “adding 10 and 15:” value=$(addem 10 15) echo $value