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
MKID(1) 							   User Commands							   MKID(1)

NAME
mkid - Build an identifier database SYNOPSIS
mkid [OPTION]... [FILE]... DESCRIPTION
Build an identifier database. -o, --output=OUTFILE file name of ID database output -f, --file=OUTFILE synonym for --output -i, --include=LANGS include languages in LANGS (default: "C C++ asm") -x, --exclude=LANGS exclude languages in LANGS -l, --lang-option=L:OPT pass OPT as a default for language L (see below) -m, --lang-map=MAPFILE use MAPFILE to map file names onto source language -d, --default-lang=LANG make LANG the default source language -p, --prune=NAMES exclude the named files and/or directories -v, --verbose report per file statistics -s, --statistics report statistics at end of run --files0-from=F tokenize only the files specified by NUL-terminated names in file F --help display this help and exit --version output version information and exit FILE may be a file name, or a directory name to recursively search. If no FILE is given, the current directory is searched by default. Note that the `--include' and `--exclude' options are mutually-exclusive. The following arguments apply to the language-specific scanners: C language: -k,--keep=CHARS Allow CHARS in single-token strings, keep the result -i,--ignore=CHARS Allow CHARS in single-token strings, toss the result -u,--strip-underscore Strip a leading underscore from single-token strings C++ language: -k,--keep=CHARS Allow CHARS in single-token strings, keep the result -i,--ignore=CHARS Allow CHARS in single-token strings, toss the result -u,--strip-underscore Strip a leading underscore from single-token strings Java language: -k,--keep=CHARS Allow CHARS in single-token strings, keep the result -i,--ignore=CHARS Allow CHARS in single-token strings, toss the result -u,--strip-underscore Strip a leading underscore from single-token strings Assembly language: -c,--comment=CHARS Any of CHARS starts a comment until end-of-line -k,--keep=CHARS Allow CHARS in tokens, and keep the result -i,--ignore=CHARS Allow CHARS in tokens, and toss the result -u,--strip-underscore Strip a leading underscore from tokens -n,--no-cpp Don't handle C pre-processor directives Text language: -i,--include=CHAR-CLASS Treat characters of CHAR-CLASS as token constituents -x,--exclude=CHAR-CLASS Treat characters of CHAR-CLASS as token delimiters Perl language: -i,--include=CHAR-CLASS Treat characters of CHAR-CLASS as token constituents -x,--exclude=CHAR-CLASS Treat characters of CHAR-CLASS as token delimiters -d,--dtags Include documentation tags Lisp language: REPORTING BUGS
Report bugs to bug-idutils@gnu.org mkid - 4.5 August 2012 MKID(1)
All times are GMT -4. The time now is 04:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy