Really, I’d suggest using nmap as a single line rather than sending it to the $ports variable and calling it a second time, but it depends on what automation you have in place.
Thanks for that, i’m kinda new to linux and was hoping to find just that.
1 more question though: why the “s” in “sed s/,$//” ? i know the comma and the slash are escaped with the “/”, $ is end of line, but still can’t figure out what the “s” is for. is it just to prevent it from reading the first “/” as an argument? like it could in fact be any letter?
i know the comma and the slash are escaped with the “/”, $ is end of line,
Well, not really here. An escape in bash is normally \.
Doing a replace with sed is basically the format:
sed 's/search/replace/g'
So they aren’t escapes in this context. It is search for , at the end of a line and replace with /.
but still can’t figure out what the “s” is for. is it just to prevent it from reading the first “/” as an argument? like it could in fact be any letter?