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
parent not waiting until child complete executing another program through execl() vvaidyan High Level Programming 4 05-16-2008 07:00 AM
complete noob avdrummerboy UNIX for Dummies Questions & Answers 3 12-04-2006 12:25 PM
Auto complete Tom_Zamani UNIX Desktop for Dummies Questions & Answers 4 07-28-2005 06:30 AM
Auto Complete under AIX truma1 UNIX for Advanced & Expert Users 7 10-11-2001 12:08 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 01-15-2008
sridhusha sridhusha is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 16
Please complete this program.

Hi All,

I need some help to complete the below script, after executing below script blank lines are coming, but i am expecting 4 digit numeric no. Please solve the issue ASAP.


function portno { while (true) do random=`echo $RANDOM | cut -c 1-4` port=`netstat -a | grep -c $random` if [ $port -ne 1 ]; then break else continue fi done return $port } port1=`portno` port2=`portno` echo "$port1" echo "$port2"
Code:
function portno
{
while (true)
do
random=`echo $RANDOM | cut -c 1-4`
port=`netstat -a | grep -c $random`

if [ $port -ne 1 ];
then
        break
else
        continue
fi
done
return $port
}

port1=`portno`
port2=`portno`

echo "$port1"
echo "$port2"
        
-->
Code:
function portno
{
while (true)
do
random=`echo $RANDOM | cut -c 1-4`
port=`netstat -a | grep -c $random`

if [ $port -ne 1 ];
then
        break
else
        continue
fi
done
return $port
}

port1=`portno`
port2=`portno`

echo "$port1"
echo "$port2"
Thanks in advance...

Regards,
Sridhar.

Last edited by blowtorch; 01-15-2008 at 08:24 PM.. 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 07:49 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