bash script use cut command at variable and store result at another variable

The awk solution is what I would use, but if you want to understand your problems with bash, here is a revised version of your script. #!/bin/bash -vx ##config file with ip addresses like 10.10.10.1:80 file=config.txt while read line ; do ##this line is not correct, should strip :port and store to ip var ip=$( … Read more

TraceRoute and Ping in C#

Given that I had to write a TraceRoute class today I figured I might as well share the source code. using System.Collections.Generic; using System.Net.NetworkInformation; using System.Text; using System.Net; namespace Answer { public class TraceRoute { private const string Data = “aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa”; public static IEnumerable<IPAddress> GetTraceRoute(string hostNameOrAddress) { return GetTraceRoute(hostNameOrAddress, 1); } private static IEnumerable<IPAddress> GetTraceRoute(string … Read more

How can I write a Linux bash script that tells me which computers are ON in my LAN?

I would suggest using nmap’s ping-scan flag, $ nmap -sn 192.168.1.60-70 Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2009-04-09 20:13 BST Host machine1.home (192.168.1.64) appears to be up. Host machine2.home (192.168.1.65) appears to be up. Nmap finished: 11 IP addresses (2 hosts up) scanned in 0.235 seconds That said, if you want to write it … Read more

How can I ping a server port with PHP?

I think the answer to this question pretty much sums up the problem with your question. If what you want to do is find out whether a given host will accept TCP connections on port 80, you can do this: $host=”193.33.186.70″; $port = 80; $waitTimeoutInSeconds = 1; if($fp = fsockopen($host,$port,$errCode,$errStr,$waitTimeoutInSeconds)){ // It worked } else … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)