I have a shell script (count_reviews.sh) that contains the following:
#!/bin/bash
grep -c "Author" "#1"
I have tried using "$1" as I found that this takes the first argument in the command line but I still get the error mentioned below. I have also used chmod +x to make my file executable.
The script counts the number of times "Author" appears in the file. I am required to be able to make the command line take an input of "% ./count_reviews.sh hotel_72572.dat"
where hotel_72572.dat
is an example file name. The number of times author appears will then be printed out underneath. When I do this however, I am getting an error -bash: fg: %: no such job
. What is causing this and how do I fix it? My count_reviews.sh
file is in the same directory as all of my hotel data files if that matters.