#!/bin/bash

m=$(node ./node_modules/.bin/portastic find 8888 9999);

arr=$(echo $m | tr "," "\n")
i=0;
for x in $arr;
do
    echo $((i= i + 1 ))
    if [ $i -eq 5 ]
    then
        echo "#!/bin/sh
        export port=$x" > ./node_modules/.bin/env.sh
        break;
    else
        echo $x;
    fi
done
