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?
Drop the space:
result=`cat launched | grep MyTest`
Even better, drop the UUOC :
result=`grep MyTest launched`
You've got an extra space:
result= `cat launched | grep MyTest`
^---
variable assignments must not have spaces on either side of the =
.
在重音之前移开空间,您的问题就消失了
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.