I am a beginner in writing shell script (probably my 1st shell script). I have a shell script that I like to run. The command is a simple grep command based on the parameter passed to it. I managed to get the correct grep command using the script below.
FILE='testurls'
MERCHANT_ID='8'
printf "grep '^%s' %s\n" "$MERCHANT_ID" "$FILE"
./hello.sh
grep '^8' testurls
How would I execute the command instead of printing it.
PATH,EDITOR,SHELL, ...) and internal shell variables (BASH_VERSION,RANDOM, ...) are fully capitalized. All other variable names should be lowercase. Since variable names are case-sensitive, this convention avoids accidentally overriding environmental and internal variables.