Shell Scripting Shift Through Parameters
Shift command is a built-in command. Command takes number as argument. Arguments shift down by this number.
For example, if number is 5, then $5 become $1, $6 become $2 and so on.
The shift command is mostly used when arguments are unknown. Arguments are processed in a while loop with a condition of (( $# )). this condition holds true as long as arguments are not zero. Number of arguments are reduced each time as the shift command executes.
Look at the above snapshot, this is our script.
Look at the above snapshot, this is the output of the above script.
The read command allows a user to provide the runtime input.
Look at the above snapshot, this is our script using read command.
Look at the above snapshot, a user can enter the name in the shell.
Next TopicSourcing a config file