Quote:
I was really trying to ask brian00 how this was supposed to work so that I can understand it and he can double-check it is the right thing. Personally I'd take away the '$' and replace 'ls' with 'cat' and try that. |
OK, I just tried what I suggested and
Code:
#!/bin/bash Code:
$ ./test.sh So to cheat you could echo whatever you wanted. Of course there will be a way of using grep and regular expressions to do this properly. The above is for illustrative purposes only to explain the logic I meant. |
Thanks so much to everyone, specially 273 b/c it worked now.
one more question: what if I want to add another string, basically, my condition is if both string exit then execute aything below it (both string has to exist) Code:
#!/bin/bash |
This works but, again, it's not ideal and someone with a knowledge of scripting ought to be able to point out a correct solution:
Code:
#!/bin/bash Remember that the pipe | is just passing the result of the previous action not the whole file. This was my point about passing the result of ls to grep but I'm not familiar enough with the logic of bash to know whether there was an exception there somewhere. |
Code:
grep MYDB$ <filename here> |grep DUMMY |
All times are GMT -5. The time now is 03:21 AM. |