How to write bash script

broken image
broken image

It’s a very simple script that yet can prove very useful! You can supply any filename as an argument to the script and it will display the location of your file:

broken image
broken image

The following script count_lines.sh will output the total number of lines that exist in whatever file the user enters: #!/bin/bash In this tutorial, you will learn how you can pass variables to a bash scripts from the command line. So far, you have learned how to use variables to make your bash scripts dynamic and generic, so it is responsive to various data and different user input. Arguments can be useful, especially with Bash!

broken image