Sorry about this newbie question but I am new scripting. Here is my script.
#!/bin/bash if [ ps -axf|grep -c "/sbin/mingetty" -eq 6 ]; then echo yep else echo nope fi
I have also tried this with single quotes around /sbin/mingetty and with cancelled parentheses for better grouping. When I run it as above, I get the followin lines. test: [: missing `]' /sbin/mingetty:3 grep: 6: No such file or directory grep: ]: No such file or directory nope for some reason it looks like it is not grouping correctly. Any ideas?
Jason R. Kretzer<br />Software Engineer<br />System Administrator<br /><a href="http://alia.iwarp.com" target="_blank" rel="nofollow">http://alia.iwarp.com</a>
Jason, You just need to put backticks (`) around your ps command:
The backticks execute the command and return the value in place. The "backtick" is the character that's usually on the same key as the tilda (~) for those that may not be familiar with the term. Jim [ September 02, 2002: Message edited by: James O'Dell ]