Trying find and increment script
I am working on a script that will search a directory for certain file names and increment a variable by one for each result returned. Each time I search this file name, the file found will also be deleted. I would like this script to be run about every 6 hours or so. We'll call this script A.
I also have a script that runs daily that I would like to tack the count to the end of the text file that it outputs. We'll call this script B. I'm confident that I would want to store the count from script A to a text file to be called in by script B, but don't know how to do so. Here's what I have so far: Code:
#!/bin/bash Now, for those of you that know what you're doing, you're already shaking your head because you know that, no matter what, at the end of the script $SD will end up being 14. The problem is I don't know how to tell bash that if there is a result returned, increment by one. If there is no result returned, move to the next command. Beyond that, I'll need to know how to call the text of a file in to a variable so I can plug it in to the text output of script B. Any tips? |
From this page http://tldp.org/LDP/abs/html/ops.html
Quote:
Use Quote:
Grab a value from a file Code:
num=$(cat file) |
Quote:
Code:
#!/bin/bash |
Code:
wc -l test.pl|awk '{print $1}' http://www.ibm.com/developerworks/library/l-awk1.html |
All times are GMT -5. The time now is 11:31 PM. |