These simple script examples will help you understand the process and introduce you to the basics of Bash programming.
In this case, it uses the Bash interpreter.
For example, you’ve got the option to create a new directory from your script using themkdircommand.
you might supply an argument when you run a program, to control its behavior.
$2 will refer to the second argument, and so on.
You may be wondering what happens if you execute the script without supplying an argument at all.
you’re free to then call that function whenever you gotta.
Heres an example of a function that deletes a given file.
Create a Basic Calculator for Arithmetic Calculations
This final example demonstrates a very basic calculator.
It lets you test a valuein this case, thechoicevariableagainst several fixed values and run associated code.
This script uses thebccommand to carry out each calculation.