We will see how to pass these as arguments from the command line to the script. The bash script is:
#!/bin/bash INPUT_FILE=$1 WORD=$2 grep "$WORD" $INPUT_FILE
Now run the script as shown below:
bash grep_script_command_line.sh sample_file.txt server
#!/bin/bash INPUT_FILE=$1 WORD=$2 grep "$WORD" $INPUT_FILE
Now run the script as shown below:
bash grep_script_command_line.sh sample_file.txt server
Comments
Post a Comment