Why is it that no matter how long I put the sleep command or loop, cat is unable to read the file, even though
the file already exsists? Is there any way of reliably waiting for the whois to finish, write to file and then read that the file exsists?? Could this have anything to do with using network mapped diretories or using cygwin?

whoisDoc=`whois -H "$query" > "/cygdrive/location/whois$query"`
    netName=" "
    orgName=" "
    Country=" "
    #Wait for whois to be written to disk
    cat whois$query > /dev/null
    while [ $timer -ne 0 ];do
        sleep 5
        if [ $escape -gt 100 ];then
        cat whois$query
    #add whois to array
    netName=$(cat whois$query | grep -i 'netname'| gawk '{print $2}')
    orgName=$(cat whois$query | grep -i 'orgname'| gawk '{print $2}')
    Country=$(cat whois$query | grep -i 'Country'|gawk '{print $2}')
    echo $Country","$orgName","$netName > /dev/tty

Here is the Error that repeats with the loop.
cat: whoisfile: No such file or directory

Recommended Answers

cat whois$query
give file its (full) path!

Jump to Post

All 2 Replies

cat whois$query
give file its (full) path!


Thanks for the help, maybe it is time for me to take a breather from coding.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.