Sponsored Content
Top Forums Shell Programming and Scripting End of loop condition required??? Post 302127043 by vino on Monday 16th of July 2007 03:02:42 AM
Old 07-16-2007
Quote:
Originally Posted by skyineyes
#!/user/bin
NAMES=`ls *.txt`
echo $NAMES

The content of this NAMES variable are TOKENS seperated by spaces.

i want to pass each token to another script called run.sh as follows:


while [<ALL tokens in $NAMES one by one>]
do
sh run.sh <TOKEN>
done

please provide the logic for seperating NAMES token and then calling run.sg with each token ????
You would be better off with using a for loop
Code:
NAMES=`ls *.txt`
echo $NAMES
for file in $NAMES
do
  sh run.sh $file
done

or better yet
Code:
for file in *.txt
do
  sh run.sh $file
done

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Urgent Help required : awk/sed help to find pattern and delete till end of line

Hi, I need help with using an awk or sed filter on the below line ALTER TABLE "ACCOUNT" ADD CONSTRAINT "ACCOUNT_PK" PRIMARY KEY ("ACCT_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1) TABLESPACE "WMC_DATA" LOGGING ENABLE Look for... (1 Reply)
Discussion started by: rajan_san
1 Replies

2. Programming

Why is required to leave an empty line at the end of a C program?

I know it looks like a stupid question, but i really wanna know the reason. Actually, i think it's because the c compiler will detect it as the end of file "EOF" of the program, but, am i wrong? because it compiles it anyway, but keep showing warnings like "no new line at the end of file". I... (8 Replies)
Discussion started by: semash!
8 Replies

3. Shell Programming and Scripting

if condition in a while loop

Gurus, I need to read a line from a file and strip the characters from it and compare the stripped value with the value I pass to the script while executing it. Below is the code for the same. But when i execute the code, it is throwing an error. #!/bin/ksh . /home/.i_env ... (14 Replies)
Discussion started by: svajhala
14 Replies

4. Shell Programming and Scripting

Use of -z in while loop condition

Hi, Could you please tell what is the meaning of -z in while loop condition. For example, while ; do echo "*** Enter the age " readage (3 Replies)
Discussion started by: vidyaj
3 Replies

5. Shell Programming and Scripting

Print required values at end of the file by using AWK

I am looking help in awk, quick overview. we will get feed from external system . The input file looks like below. Detail Id Info Id Order Id STATUS Status Date FileDetail 99127942 819718 CMOG223481502 PR 04-17-2011 06:01:34PM... (7 Replies)
Discussion started by: dvrbabu
7 Replies

6. Shell Programming and Scripting

Help with extract info if fulfill condition required

Input file (4 DATA record shown in this case): DATA AA0110 ACCESSION AA0110 VERSION AA0110 GI:157412239 FEATURES Location/Qualifiers length 1..1170 1..1700 /length="1170" position ... (5 Replies)
Discussion started by: perl_beginner
5 Replies

7. Shell Programming and Scripting

While Loop with if else condition

Hi, I was trying to write a shell script which reads csv file and sends mail in html format along with tables. Hope i have completed 1st part , but while sending mail i was trying to highlight some rows in the table based on the egrep outcome. If the string exists in line/INPUT, i am trying to... (4 Replies)
Discussion started by: varmas424
4 Replies

8. Shell Programming and Scripting

If condition help required

I have a if condition it checks its pid exist it means it is running, otherwise not running. I am checking with ps x=`ps -fu myuserid|grep java| |grep -v grep | awk '{print $2}'` if then ............ Above code is giving integer error, because currently process of java is... (4 Replies)
Discussion started by: learnbash
4 Replies

9. UNIX for Dummies Questions & Answers

Bash condition test at the end of string

I want to check (using bash condition test function) if string contains three spaces, ignoring last three spaces at the end of string. string_to_report='foo bar foo bar ' string_to_ignore='foo bar ' (8 Replies)
Discussion started by: useretail
8 Replies

10. Shell Programming and Scripting

Shell file if condition setting start and end dates

I have shell file that has the following logic, i am new to shell programming. What does process month $1 do? I am assuming that the below dates go back three months from sysdate month. is it right : curr_month=`date +%Y%m` Beg_o_time=`date -d "2012/03/01" +%Y%m` Process_months=$1... (1 Reply)
Discussion started by: cplusplus1
1 Replies
Authen::SASL(3) 					User Contributed Perl Documentation					   Authen::SASL(3)

NAME
Authen::SASL - SASL Authentication framework SYNOPSIS
use Authen::SASL; $sasl = Authen::SASL->new( mechanism => 'CRAM-MD5 PLAIN ANONYMOUS', callback => { pass => &fetch_password, user => $user, } ); DESCRIPTION
SASL is a generic mechanism for authentication used by several network protocols. Authen::SASL provides an implementation framework that all protocols should be able to share. The framework allows different implementations of the connection class to be plugged in. At the time of writing there were two such plugins. Authen::SASL::Perl This module implements several mechanisms and is implemented entirely in Perl. Authen::SASL::XS This module uses the Cyrus SASL C-library (both version 1 and 2 are supported). Authen::SASL::Cyrus This module is the predecessor to Authen::SASL::XS. It is reccomended to use Authen::SASL::XS By default the order in which these plugins are selected is Authen::SASL::XS, Authen::SASL::Cyrus and then Authen::SASL::Perl. If you want to change it or want to specifically use one implementation only simply do use Authen::SASL qw(Perl); or if you have another plugin module that supports the Authen::SASL API use Authen::SASL qw(My::SASL::Plugin); CONTRUCTOR new ( OPTIONS ) The constructor may be called with or without arguments. Passing arguments is just a short cut to calling the "mechanism" and "callback" methods. callback => { NAME => VALUE, NAME => VALUE, ... } Set the callbacks. See the callback method for details. mechanism => NAMES mech => NAMES Set the list of mechanisms to choose from. See the mechanism method for details. debug => VALUE Set the debug level bit-value to "VALUE" Debug output will be sent to "STDERR". The bits of this value are: 1 Show debug messages in the Perl modules for the mechanisms. (Currently only used in GSSAPI) 4 With security layers in place show information on packages read. 8 With security layers in place show information on packages written. The default value is 0. METHODS mechanism ( ) Returns the current list of mechanisms mechanism ( NAMES ) Set the list of mechanisms to choose from. "NAMES" should be a space separated string of the names. callback ( NAME ) Returns the current callback associated with "NAME". callback ( NAME => VALUE, NAME => VALUE, ... ) Sets the given callbacks to the given values client_new ( SERVICE, HOST, SECURITY ) Creates and returns a new connection object for a client-side connection. server_new ( SERVICE, HOST, OPTIONS ) Creates and returns a new connection object for a server-side connection. error ( ) Returns any error from the last connection The Connection Class server_start ( CHALLENGE ) server_start begins the authentication using the chosen mechanism. If the mechanism is not supported by the installed SASL it fails. Because for some mechanisms the client has to start the negotiation, you can give the client challenge as a parameter. server_step ( CHALLENGE ) server_step performs the next step in the negotiation process. The first parameter you give is the clients challenge/response. client_start ( ) The initial step to be performed. Returns the initial value to pass to the server or an empty list on error. client_step ( CHALLENGE ) This method is called when a response from the server requires it. CHALLENGE is the value from the server. Returns the next value to pass to the server or an empty list on error. need_step ( ) Returns true if the selected mechanism requires another step before completion (error or success). answer ( NAME ) The method will return the value returned from the last call to the callback NAME property ( NAME ) Returns the property value associated with "NAME". property ( NAME => VALUE, NAME => VALUE, ... ) Sets the named properties to their associated values. service ( ) Returns the service argument that was passed to *_new-methods. host ( ) Returns the host argument that was passed to *_new-methods. mechanism ( ) Returns the name of the chosen mechanism. is_success ( ) Once need_step() returns false, then you can check if the authentication succeeded by calling this method which returns a boolean value. Callbacks There are three different ways in which a callback may be passed CODEREF If the value passed is a code reference then, when needed, it will be called and the connection object will be passed as the first argument. In addition some callbacks may be passed additional arguments. ARRAYREF If the value passed is an array reference, the first element in the array must be a code reference. When the callback is called the code reference will be called with the connection object passed as the first argument and all other values from the array passed after. SCALAR All other values passed will be used directly. ie it is the same as passing an code reference that, when called, returns the value. SEE ALSO
Authen::SASL::Perl, Authen::SASL::XS, Authen::SASL::Cyrus AUTHOR
Graham Barr <gbarr@pobox.com> Please report any bugs, or post any suggestions, to the perl-ldap mailing list <perl-ldap@perl.org> COPYRIGHT
Copyright (c) 1998-2005 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.16.2 2012-09-04 Authen::SASL(3)
All times are GMT -4. The time now is 10:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy