Chapter 9 Challenges
From Linux Shell Scripting Tutorial - A Beginner's handbook
- Decide whether the following sentence is true or false:
- The function file does not need to be executable.
- The function is treated the same as other shell command.
- To invoke the function, just type the name of the function.
- You must create a function at the start of a script.
- You must write a function before invoking it.
- All single line function must follow the final command with a semicolon.
- A recursive function is a function that repeatedly calls itself.
- The return command return from a function with an exit status.
- The { list; } also creates a function. (
[ $# -eq 0 ] && { echo "I'm function"; exit 1; }) - Bash does support pointer arithmetic, and indirect referencing just like C programs.
- Create user-defined functions in a shell script for the following tasks:
- add_user() - Add a user to the system.
- add_group() - Add a group to the system.
- change_password() - Change user password.
- delete_user() - Remove a user from the system.