Quantcast
Channel: Bash Script errors when trying to grep -v -q in if statement - Unix & Linux Stack Exchange
Browsing all 2 articles
Browse latest View live

Answer by Steven Penny for Bash Script errors when trying to grep -v -q in if...

An if statement will accept anything that produces exit status, so either a shell builtin like [ or test - or a disk file like grep. You can use both: if [ "$(grep -c '*' file)" = 0 ] then echo 'star...

View Article



Bash Script errors when trying to grep -v -q in if statement

I'm trying to write a script that does something when the read line does not include a * symbol in the line. I've tried the following with no success: if [ grep -v -q '*' ] which results in a too many...

View Article
Browsing all 2 articles
Browse latest View live




Latest Images