Sponsored Content
Top Forums Shell Programming and Scripting while read loop w/ a nested if statement - doesn't treat each entry individually Post 302150558 by Smiling Dragon on Tuesday 11th of December 2007 07:43:54 PM
Old 12-11-2007
Java

Your script looks like it would send one email per ldap suffix that has a problem - and that's the issue right?
I think you are wanting one email containing a list of all the failing suffixes?

In which case, try this:
Code:
#!/bin/sh
errors=""
while read i
do
  ldapsearch -h server1 -b "$i" objectclass=* ibm-replicationState |grep ibm-replicationState=ready > /dev/null 2>&1 || errors="${errors}
${i}"
done <ldaplist
if [ -n "$errors" ]
then
  echo $errors | mailx -s "LDAP sync alert on `hostname`" u@mail.com 2>&1
fi

(Untested)
BTW, The linefeed between errors} and ${i}" is not accidental, you want that in there
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

nested read

I am hoping someone can help me with this one. I am writing a ksh script on Solaris. I want to read in host names and some other info from a file, do an "rsh host 'shutdown'" (or any uname for now until I get it working), and then be given some options. The problem is I am using while read... (2 Replies)
Discussion started by: TioTony
2 Replies

2. Shell Programming and Scripting

Nested while read line loop

Hi, Can anyone please help me: i'm trying to read a file with directory-names , then go to that directory and read another (output) file to perform some tasks per line (second read line in the part of script below). The problem is that after the nested while loop has finished, the first while... (7 Replies)
Discussion started by: Rakker
7 Replies

3. UNIX for Dummies Questions & Answers

Nested If statement within Do / Done

Hi all! I'm really hoping you can help me out here; now i have searched and searched and have at least worked out that you can't have a nested if statement with a 'done' in it (as i have) as you're killing the parent before the child. So here's what i have, and here's hoping someone can help... (2 Replies)
Discussion started by: dalgibbard
2 Replies

4. Shell Programming and Scripting

If-statement nested in case

I'm trying to write case statements with 'if statements' embedded inside of them. I'm using the korn shell but it's not functioning. If I want to see if a string exists in a file and then perform an action, what would be the best way to do this? For file "asg51fin" to delete a line if a... (1 Reply)
Discussion started by: dazeman27
1 Replies

5. Shell Programming and Scripting

Perl nested if statement

I'm just having a bit of trouble running this code. It tells me that there's a syntax error on line 29. Any help appreciated. #!/usr/bin/perl # # Phone Book Application # %phonebook = ( "Wayne", '34687368', "Home", '378643287', "Work", '017374637', "School",... (2 Replies)
Discussion started by: cabaiste
2 Replies

6. Shell Programming and Scripting

Nested While loop doesn't end

Hi, Below is my script in which i am using nested while loop to read two files and move the files to a remote server. My issue is that the 2nd while loop doesn't stop executing and it keeps on executing. Can someone please let me know where i have gone wrong. myFile=$ESER_TEST_FILES ... (2 Replies)
Discussion started by: funonnet
2 Replies

7. UNIX for Dummies Questions & Answers

Read statement within while read loop

hi, this is my script #!/bin/ksh cat temp_file.dat | while read line do read test if ]; then break else echo "ERROR" fi done when i execute this code , the script does wait for the user input . it directly prints "ERROR" and terminates after the no. of times as there... (3 Replies)
Discussion started by: siva1612
3 Replies

8. UNIX for Dummies Questions & Answers

Statement to find if an entry exists in a file

I need to check if an entry input by the user is in a file. If so, I need to run a command, and if it does not exist then it should output entry does not exist. So I have so far... echo "Enter record:" read record //command || //command Can I use an if statement to do this? (3 Replies)
Discussion started by: itech4814
3 Replies

9. Shell Programming and Scripting

How come this if statement doesn't work?

greetings, the following code isn't working as i expect it to. the first dbl brackets do but the second set gets ignored. ie: if i'm on t70c6n229 it echoes "Something" and i expect it not to. what am i missing? if " ]] || " ]]; then echo "Something" fi thanx! (9 Replies)
Discussion started by: crimso
9 Replies

10. Shell Programming and Scripting

awk doesn't understand 'read' statement!!!

While working on awk programming, i found that it doesn't understand 'read' statement. Then what's the use of 'continue' and 'break' statement in awk. For ex: awk '{k=1; while (k<10) {print $0; k++}}' emp.lst Now, please say if I want to put the logic that after priting 1 line, it will ask for... (13 Replies)
Discussion started by: ravisingh
13 Replies
sane-pie(5)							File Formats Manual						       sane-pie(5)

NAME
sane-pie - SANE backend for PIE, Devcom and AdLib SCSI flatbed scanners DESCRIPTION
The sane-pie library implements a SANE (Scanner Access Now Easy) backend that provides access to PIE, Devcom and AdLib SCSI flatbed scan- ners. At present, the following scanners should work with this backend: Model: Status ---------------------- ------ Devcom 9636PRO OK Devcom 9636S Untested Devcom 9630S Untested ScanAce 1236S Untested ScanAce 1230S Untested ScanAce II Untested ScanAce III Untested ScanAce Plus Untested ScanAce II Plus Untested ScanAce III Plus Untested ScanAce V Untested ScanAce ScanMedia Untested ScanAce ScanMedia II Untested ScanAce 630S Untested ScanAce 636S Untested JetScan 630 OK JetScan 636PRO Untested FILES
/etc/sane.d/pie.conf The backend configuration file /usr/lib/sane/libsane-pie.a The static library implementing this backend. /usr/lib/sane/libsane-pie.so The shared library implementing this backend (present on systems that support dynamic loading). SEE ALSO
sane(7) CONTACT AND BUG-REPORTS Please send any information and bug-reports to: Simon Munton <simon@munton.demon.co.uk> 7 Sept 2000 sane-pie(5)
All times are GMT -4. The time now is 02:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy