![]() |
if condition and grep
hey all
im trying to write a script, need some help concept goes like this: i want to grep a file for a word/phrase, and depending on grep's output (basically, any output at all = found, NULL = not found) to do -something-. basically, in pseudocode: :
if(grep_output == NULL): |
Re: if condition and grep
okay, figured it out.
:
grep_output=`grep <word> <file>` |
Re: if condition and grep
:
|
Re: if condition and grep
More streamlining! :)
:
#!/bin/bashOr if you want to have the grep output in a variable to manipulate it later, here's a tidier version of your original example (your original example will work fine, some of us just like to tweak ;) :
#!/bin/bash |
| All times are GMT -5. The time now is 10:10 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC