none
Convert shell script to Powershell RRS feed

  • Question

  • I have a shell script ..need to powershell..can some one help me on this?

    echo "[{" > data.txt

    for i in `cat pending.txt`

    do

            timeout 2 telnet $i 22 > test.txt 2>&1

            cat test.txt |grep "Connected to" >/dev/null 2>&1

            if [[ $? == 0 ]]; then

                     echo $i >> completed.txt

                     echo " \"status\" : \"Completed\", " >> data.txt

                     echo " \"comments\" : \"Server is reachable at $(date +"%m/%d/%Y %T") EST\", " >> data.txt

                     echo " \"assignee\" : \"WebServices\", " >> data.txt

                     echo " \"serverName\" : \"$i\" " >> data.txt

                     echo "}, { " >> data.txt

            fi

    done

    head -n -1 data.txt > data.txt.tmp

    mv data.txt.tmp data.txt

    echo "}" >> data.txt

    echo "]" >> data.txt

    diff -a --suppress-common-lines -y pending.txt completed.txt | awk {'print $1'} |grep -v ">" > test1.txt

    mv test1.txt pending.txt


    • Moved by Bill_Stewart Saturday, June 24, 2017 6:40 PM This is not "rewrite script for me in a different language" forum
    Friday, April 28, 2017 7:49 AM

All replies