0

I am making a simple chat using netcat, from this forum, and I have run into some trouble...

When executing this script:

#!/bin/bash
sshpass -p \!Password ssh maliciouzzhd@10.0.0.1 "export DISPLAY=:0 && xterm -e \"mawk -W interactive "$0='Jacob: '$0" | nc -l -p 1234 -s 10.0.0.1\"" &
sleep 2
echo "Chat Started!" && mawk -W interactive '$0="Parents: "$0' | nc 10.0.0.1 1234

I get:

mawk: line 1: syntax error at or near =

(I am executing the script from my Mac, so the first line of code will start the connection from my laptop, the third will connect to the laptop from the Mac)

If anyone knows how to fix this, it would be greatly appreciated!

  • Your quoting looks screwed up to me - what are you actually trying to pass to mawk in the ssh session? I suspect `$0` is being expanded to the name of the shell – steeldriver Feb 04 '17 at 14:28
  • I'm trying to execute everything in the first set of `"` (First `"` and last `"`) in an xterm, but the guide i was following said that the mawk expression had both `"` and `'` – MaliciouZzHD Feb 05 '17 at 06:53
  • That is too much quoting for me. Just make a script of the thing, put it on the remote system and run that scrip instead. – muru Feb 09 '17 at 16:35

0 Answers0