I have the below code. After doing copy and move if there is an error that should be initially captured as 1 and incremented for each error with exiting. Finally if the total error count to be greater than 2 then I need to exit the script.
########################
Please let me know how to acheive this.
Thanks.
Last edited by Don Cragun; 07-16-2014 at 09:38 PM..
Reason: Add CODE tags.
Your pseudo-code raise lots of ambiguities. You have ifs and thens, but no elses or fis.
count it as digit is not a valid shell command and doesn't seem to match the comments before your pseudo-code.
If you are using any POSIX conforming shell (such as ksh or bash), you could also try this alternative to what fpmurchpy suggested:
As shown by fpmurphy, some of the arithmetic could be further simplified with a 1993 or later version of ksh or a recent version of bash. This code won't hide the diagnostics if some of the commands fail. (The code fpmurphy suggested will hide any diagnostics.)
It seems very strange to me to try to perform either of those mv commands if the corresponding cp command preceding it failed. It also seems very strange to return a 0 exit code if one or two of the cp or mv commands fails. But this code seems to do what you asked for.
This User Gave Thanks to Don Cragun For This Post:
Hi,
I have a file with a list of bunch of IP addresses from different VLAN's . I am trying to find the list the number of each vlan occurence in the output
Here is how my file looks like
1.1.1.1
1.1.1.2
1.1.1.3
1.1.2.1
1.1.2.2
1.1.3.1
1.1.3.2
1.1.3.3
1.1.3.4
So what I am trying... (2 Replies)
hi All, Any one answer my requirement.
I have source location
src_dir="/home/oracle/arun/IRMS-CM"
My Target location
dest_dir="/home/oracle/arun/LiveLink/IRMS-CM/$dc/$pc/$ct"
my source text files check with below example.text file content
$fn "\t" $dc "\t" $pc "\t" ... (3 Replies)
I need to read a trigger file whose name can be:
ABC!DEF@2014.txt
or
ABC!DEF@2014,2015.txt
and then carry out functions on those inputs.
Currently I am doing:
YEAREXPORT {
FILE= xyz.txt
ls ABC* -l > ${FILE}
if ; then
log_err "Trigger File ABC* does not exist!"
fi (4 Replies)
What I'm trying to accomplish. I receive a Header and Detail file for daily processing. The detail file comes first which holds data, the header is a receipt of the detail file and has the detail files record count. Before processing the detail file I would like to put a wrapper around another... (4 Replies)
Hi all,
I want to write a awk script that counts unique IPs that have received one special error.
For example
25-04-2012;192.168.70.31;1254545454545417;500.0;SUCCESS
25-04-2012;192.168.70.32;355666650914;315126423993;;General_ERROR_23
30-04-2012;192.168.70.33;e;null;null;Failure... (4 Replies)
Hi all,
I want to write a awk script that counts unique IPs that have received one special error.
For example
25-04-2012;192.168.70.31;1254545454545417;500.0;SUCCESS
25-04-2012;192.168.70.32;355666650914;315126423993;;General_ERROR_23
30-04-2012;192.168.70.33;e;null;null;Failure... (2 Replies)
I have a sorted file like:
Apple 3
Apple 5
Apple 8
Banana 2
Banana 3
Grape 31
Orange 7
Orange 13
I'd like to search $1 and if $1 is not the same as $1 in the previous row print that row and print the number of times $1 was found.
so the output would look like:
Apple 8 3
Banana... (2 Replies)
I am trying to figure out how to run the below variable assignment in a shell script so that it will snuff the "no such file or directory" and just pass the count value. That way I can do a valid compare in the next step.
num=`ls /appsrv/tmp/PrjRefData_20090428-*_in.xml | wc -l`
ls:... (3 Replies)
I am trying to test some multiply function under bash shell, as you can see from the following
$ let 'count = 1.2 * 100'
bash: let: count = 1.2 * 100: syntax error in expression (error token is ".2 * 100")
does not work, seems bash shell does not like ".2"
$ let 'count = 1 * 100'
... (2 Replies)
Sirs/Madame,
On my HP-Unix, I came across an error GRECV-count exceeded and as a result of this, systems got hanged and server came down. Graceful shutdown too was not allowed.
Kindly, Can anybody help me out in killing this issue
Bhavani.R (0 Replies)