Maybe it's just /bin/sh vs /bin/ksh. It works both ways for me. This is my test system:
[mute@sunny ~]$ uname -a
SunOS sunny 5.10 Generic_141444-09 sun4u sparc SUNW,Sun-Blade-100
I really don't know the matter at the moment. I prefer using bash for everything. Start it with bash, maybe try a printf instead... I dunno.
#!/bin/bash
free=`netstat -an -f inet | awk '
$1 ~ /\.[0-9]+$/ { p = $1
while (i = index(p, ".")) p = substr(p, i+1)
if (0+p >= 32768) a[0+p] = 1 }
$1 ~ /SCTP/ { exit }
END { for (p in a) count++
printf("%d", 32768 - count) }'`
echo Free ports $free
Otherwise maybe someone else can pick this up. I'll be unable to for the next couple hours.
neutronscott:
Maybe it's just /bin/sh vs /bin/ksh. It works both ways for me. This is my test system:
[mute@sunny ~]$ uname -a
SunOS sunny 5.10 Generic_141444-09 sun4u sparc SUNW,Sun-Blade-100
I really don't know the matter at the moment. I prefer using bash for everything. Start it with bash, maybe try a printf instead... I dunno.
#!/bin/bash
free=`netstat -an -f inet | awk '
$1 ~ /\.[0-9]+$/ { p = $1
while (i = index(p, ".")) p = substr(p, i+1)
if (0+p >= 32768) a[0+p] = 1 }
$1 ~ /SCTP/ { exit }
END { for (p in a) count++
printf("%d", 32768 - count) }'`
echo Free ports $free
Otherwise maybe someone else can pick this up. I'll be unable to for the next couple hours.
This works !!! you are a CHAMP. I have worked with java, weblogic support forums but this is the best forum not only for the quality of response but the swiftness in your replies, Keep up the great work and help.