I'm trying to create a simple script (one liner, actually) that takes the content of the a file, makes it random, and provides the output to netcat as the connection destination.
This is what I thought was needed:
NCIP=$(sort --random-sort /root/list.csv | head -n 1) | nc -zv -w 2 $NCIP 443
My idea is to set the variable NCIP based on the output of sort and head, and have the nc command call it. For some reason, I can't seem to make this work.
Any pointers would be greatly appreciated.
shufinstead ofsort. Both are shipped in thecoreutilspackage. Example:shuf -n 1 /root/list.csv