Recent Topics
-
rabin miller bad code correctionphillip1882 - Today, 05:55 PM
-
Any books focused on 2D C++ graphics?CalvinBroeker - Today, 05:32 PM
-
Synapse - the Next Gen Social NetworkStasysOkunevic - Today, 04:27 PM
-
What do you use on LinuxKeithAiden - Today, 03:18 PM
-
Uploading and Downloading to my website.TylerDuffin - Today, 10:35 AM
Recent Blog Entries
Recent Status Updates
-
KodeKoolit's been a long month and a half. but I did it. getting ready to launch my portfolio site!
Show comments (1)
Popular Tags
- Managed C++
- c
- programming
- networking
- stream
- Visual Basic 4 / 5 / 6
- console
- Connection
- import
- authentication
- element
- syntax
- session
- hardware
- sql
- javascript
- array
- game
- printing
- generator
- header
- html5
- mysql
- string
- c++
- timer
- loop
- java
- html
- C#
- ajax
- form
- php
- jquery
- assembly
- vb.net
- linked list
- xml
- android
- css
- login
- encryption
- setup
- calculator
- combobox
- binary
- pseudocode
- hello world
- innerHTML
- grid
Convert perl script to shell script
#1
Posted 28 January 2013 - 03:56 AM
#!/usr/bin/perl
use Env;
$status=$ENV{INSTALLATION} . "/PassPort/bin/executiveStatus";
$startCmd=$ENV{INSTALLATION} . "/PassPort/bin/startPassport";
do{
system("$startCmd");
$output=`$status`;
$output1=`netstat -an |grep 36090`;
#print $output1;
#print $output;
}while($output1 !~ m/listen/i);
Please share any kind of help/information
Best Regards,
Milan Jain
In addition to above post:
this script is use to ping a port number (in infinite loop) to check whether it is lisnening or not.
#2
Posted 28 January 2013 - 02:08 PM
Second some first draft of the translation.
status=$INSTALLATION + "/PassPort/bin/executiveStatus"; startCmd=$INSTALLATION + "/PassPort/bin/startPassport"; output="" while [1 -gt 0] $startCmd $output=$status eval "netstat -an |grep 36090" done
It's a draft, I have no bash on here, do the corrections and it will run
Edited by BlackRabbit, 28 January 2013 - 02:09 PM.
#3
Posted 05 February 2013 - 01:01 AM
What about this conditional loop. In above perl script, loop will exit once the given port started listening. how can we do it in shell???
while($output1 !~ m/listen/i);
First, just in case, a reminder : Bash shell scripting resources
Second some first draft of the translation.
status=$INSTALLATION + "/PassPort/bin/executiveStatus"; startCmd=$INSTALLATION + "/PassPort/bin/startPassport"; output="" while [1 -gt 0] $startCmd $output=$status eval "netstat -an |grep 36090" done
It's a draft, I have no bash on here, do the corrections and it will run
#4
Posted 05 February 2013 - 11:19 PM
Ok, let's do that line in an if, still I don't remember what does m/ stand for, is it for multiline? if it is the g at the end stands for it. It will go like this:
if [$output1 | sed -n "/listen/ig"]; then your code fiif you save the results in a file instead of into $output1 you can pass the file name as second parameter for sed and you will not need the pipeing
#5
Posted 06 February 2013 - 12:55 AM
Ok, let's do that line in an if, still I don't remember what does m/ stand for, is it for multiline? if it is the g at the end stands for it. It will go like this:if [$output1 | sed -n "/listen/ig"]; then your code fiif you save the results in a file instead of into $output1 you can pass the file name as second parameter for sed and you will not need the pipeing
Thanks for your help.
I will use this code and will get back to you if I faced any issues :-)
Similar Topics
-
SDK to convert video file to VOB
Started by Tonchi, 13 May 2013 In: Language Forums → C#
vob, mkv, mpeg, c#
- 2 replies
- 219 views
-
Hex String Convert into Hex and Integer
Started by Pally, 18 Apr 2013 In: Language Forums → Java
java, convert, hex, string, int
- 6 replies
- 402 views
-
How to read a text file and convert it into table in MySQL
Started by ramesh0123, 25 Feb 2013 In: Language Forums → C#
c#, mysql
- 1 reply
- 460 views
-
Cannot implicity convert type 'string' to DevComponets.DotNetBar.Controls.TextBoxX'
Started by Thryckz, 02 Feb 2013 In: Language Forums → C#- 4 replies
- 345 views
-
Convert Object to Byte[] for Inter Communication between programming languages.
Started by VNFox, 22 Jan 2013 In: Language Forums → C#- 7 replies
- 594 views














