0

Problem is, when using the sshpass command you need to use (apostrophes) in order to input the command. When I try to use nmap, I'm using hostname -I and awk. The awk ‘{print .. ‘ apostrophe clashes with the sshpass apostrophe.

Is there any alternatives or ways to change that?

I want to run:

sshpass -p “pass” ssh -o Strict…=no user@ip ‘ nmap $(hostname -I | awk ‘{print $1}’) ‘
agilgur5
  • 667
  • 12
  • 30
Koren
  • 1
  • 1

1 Answers1

0

You need to escape $ with \:

sshpass -p “pass” ssh user@ip "nmap \$(hostname -I | awk '{print \$1}')"
Ivan
  • 6,188
  • 1
  • 16
  • 23