Functions
Defining Functions
#!/bin/bash
greet(){
echo "Hello, $1!"
}
greet "Alice"
Returning Values
#!/bin/bash
add(){
result=$(( $1 + $2 ))
return result
}
add 5 10
echo "The sum is $?"
#!/bin/bash
greet(){
echo "Hello, $1!"
}
greet "Alice"
#!/bin/bash
add(){
result=$(( $1 + $2 ))
return result
}
add 5 10
echo "The sum is $?"