I have written the following shell script:
#! /bin/bash
# This script is designed to find hosts with MySQL installed
nmap -sT my_IP_address -p 3306 >/dev/null -oG MySQLscan
cat MySQLscan | grep open > MySQLscan2
cat MySQLscan2
According to the script the output of nmap should be sent to /dev/null. On the other hand, the final out put should be written to the file MySQLscan2 in my pwd.
Not as I have expected, two files are written to my pwd: MySQLscan: Contains the output of the scan that I have expected to be in MySQLscan2. MySQLscan2: This file is empty.
Is there an mistake in my script? How can I solve the problem?
Earlier today, I managed to run the script with correct output. I am not sure if I have changed the script in some way. I checked it again and again, but cannot find, what is wrong...
I am working with Kali Linux and Oracle VM Virtual Box.