Hands-on task
This task is step 19 of the course “Bash scripts: from a loop to a robust script”
A function that prints its result
Write /root/math.sh with a function square that takes a number and prints its square. Call it for the number 7 and save the result into /root/result.txt.
What you'll practise:
- bash functions
- function arguments
- command substitution
- bash arithmetic
- return vs echo