Reputation: 127
When i do the following i get results:
bash$ cat launched | egrep MyTest
MyTest
but with the following script:
#!/bin/sh
result= `cat launched | grep MyTest`
echo $result
when launching the script i get:
bash$ ./test.sh
./test.sh: MyTest: not found
I have full access rights on the script and the script is launched in the same directory as the file launched. How can i fix the script so it will return the same result as above?
Upvotes: 1
Views: 17494
Reputation: 14376
Remove the space before the grave accent and your problems go away
Upvotes: 0
Reputation: 360922
You've got an extra space:
result= `cat launched | grep MyTest`
^---
variable assignments must not have spaces on either side of the =
.
Upvotes: 1