Linux for loop KSH issue -


the following code works fine in 1 system , not other same specs.

system a:

ksh --version version         sh (at&t research) 93u+ 2012-08-01 
uname -a linux servera 2.6.32-431.5.1.el6.x86_64 #1 smp fri jan 10 14:46:43 est 2014 x86_64 x86_64 x86_64 gnu/linux 

code:

#!/bin/ksh cd /home/path/ if [ `ls -1 *.log 2>/dev/null |  wc -l` -gt 0 ] ; echo "log files more zero"   f in `ls -1 *.log` ;         echo $f         sleep 1   done fi 

output:

log files more 0 file1.log file2.log file3.log 

system b:

ksh --version version sh (at&t research) 93u+ 2012-08-01

uname -a linux serverb 2.6.32-431.5.1.el6.x86_64 #1 smp fri jan 10 14:46:43 est 2014 x86_64 x86_64 x86_64 gnu/linux 

code:

#!/bin/ksh cd /home/path/ if [ `ls -1 *.log 2>/dev/null |  wc -l` -gt 0 ] ; echo "log files more zero"   f in `ls -1 *.log` ;         echo $f         sleep 1   done fi 

output:

log files more 0 

and hangs forever .....

any thoughts why ??


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -