Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

My bash script does many things, among which creating another script. I would like to have the following line to be executed from within a script. But it does not work (grep is executed instead of pasted in search.sh). What am I doing wrong?

cat "grep --ignore-case $1 *.find" > search.sh

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

You're using the wrong command.

echo "grep --ignore-case $1 *.find" > search.sh
share|improve this answer
1  
Quotes should be single?.. –  brownian Mar 20 '12 at 8:27
add comment

Use echo instead of cat.

And because you use wildcards, maybe you want to use »'«, not »"«:

echo 'grep --ignore-case $1 *.find' >> search.sh

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.