3 ms·
Can't help but throw a couple cents/pennies around whenever an "almost perfect" or "advanced" script makes my knee jerk so wildly. So here goes. For this part:
by darrenf 5y ago
Can't help but throw a couple cents/pennies around whenever an "almost perfect" or "advanced" script makes my knee jerk so wildly. So here goes. For this part:
pro_on=$(ps aux | grep -c rsync)
# if someone is using rsync
# grep is also producing one entry so -gt 1
`grep` can be excluded from the output by putting square brackets around one character of the search pattern, like so:
pro_on=$(ps aux | grep -c rsyn[c])
Also, this:
minutes=$(($minutes - 1))
Can be more easily written as:
((minutes--))
- joosters 5y ago> `grep` can be excluded from the output by putting square brackets around one character of the search pattern That's a great trick, thanks! I'm so used to adding '| grep -v grep' at the end of a 'ps | grep' command, your way is much nicer.
- uhradone 5y agoTHX the "almost" is getting closer to "almost"!