score:1

Accepted answer

when you quote the variable $2, that prevents the shell from expanding wildcards. so you need to do:

pdfgrep -h "$1" $2

however, this will have a problem if the folder name contains spaces, because it also does word splitting. it would be better if you allowed the original shell to expand the wildcard, by not quoting the argument to the script:

bash pdfgrep.ssh "string to search" folder_to_scan/*

then you need to change the script so it passes all the arguments to pdfgrep, not just the first two:

pdfgrep -h "$@"

now i'm not sure what the point of the script is. all it does is insert the -h option to the beginning, which is less typing that bash pdfgrep.ssh.


Related Query

More Query from same tag