The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
__read_nocancel Function Causes Infinite Loop marcus121 High Level Programming 3 06-09-2009 11:27 AM
Is my code in an Infinite Loop? marcus121 High Level Programming 5 06-05-2009 02:45 PM
Script to run infinite loop digitalrg Shell Programming and Scripting 1 04-15-2009 01:23 PM
Infinite loop not looping hootdocta5 Shell Programming and Scripting 2 03-23-2009 12:38 PM
ls command in infinite Loop umakant SUN Solaris 3 07-17-2007 02:25 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 07-16-2009
tententen tententen is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 17
infinite while do loop problem

hi all,

this is how my scrip looks like

Code:
#!/bin/sh

bindir='/opt/apps/script/bin'
datadir='/opt/apps/script/data'
dir='/opt/apps/script'

while : ; do
     ls -1rt /opt/apps/script/data/check.txt*|tail -1 > /dev/null 2>&1
     if [ $? -eq 0 ] ;then
          chmod +rwx $bindir/dummy2.sh
          lastfile=`ls -1rt /opt/apps/script/data/check.txt*|tail -1` > /dev/null 2>&1
          cp $lastfile $dir/backup/
          cp $lastfile $datadir/IPLIST.txt
     else
         chmod -rwx $bindir/script_check2.sh
         exit 0
     fi
done

Its giving me infinite loop. The check.txt is not in the /opt/apps/script/data/ directory, so I thought I wanted it to do chmod -rwx $bindir/script_check2.sh and exit script straight away.

please help.

Last edited by tententen; 07-16-2009 at 08:57 AM.. Reason: code tags
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:53 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0