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 

Comments

Popular posts from this blog

Grep Command in Unix Shell script