The following code works fine in one system and not the other with 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 ] ; then
echo "Log files are more than Zero"
for f in `ls -1 *.log` ; do
echo $f
sleep 1
done
fi
Output:
Log files are more than Zero
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 ] ; then
echo "Log files are more than Zero"
for f in `ls -1 *.log` ; do
echo $f
sleep 1
done
fi
Output:
Log files are more than Zero
And it hangs forever .....
Any thoughts why ??