If I run
grep -i "echo" *
I get the results I want, but if I try the following simple bash script
#search.sh
grep -i "$1" *
echo "####--DONE--####"
and I run it with sh -x search.sh "echo" I get the following error output:
' grep -i echo '*
: No such file or directory
' echo '####--DONE--####
####--DONE--####
How come? I'm on CentOS
echo ####--DONE--####end up outputting####--FINE--####? I think there's something you're not showing here.bash -x ...instead ofsh -x ..., does it work?#!/bin/bashat the very top of your script and then running the script as./search.sh "echo"?*givesNo such file or directory.#!, the system will use#!/bin/shto execute the script. Using/bin/shvs./bin/bashmight make some difference, but not for anything I see here. If you'll copy-and-paste the exact contents of the script, and the exact output, this question might be useful in the future.