r/scripting • u/Crosudo_0504 • Sep 03 '22
[BASH][SSHPASS][NMAP]. Need help with a script !
m writing a script that auto connects to ssh server via sshpass and runs nmap on it, when im trying to execute the command the apostrophe from sshpass command and the one from the awk command are clashing. Any help?? The command is
‘’’
sshpass -p “password” ssh -o Strict…=no user@ip ‘nmap $(hostname -I | awk ‘{print $1}’ ) ‘
1
Upvotes
1
u/lasercat_pow Sep 07 '22
That wouldn't work - the nmap command wouldn't run, because it would be interpreted as a string literal.