I know I'm goofing something up. See below.
Code: Select all
#!/bin/sh
#
# start nc and listen on port number from command line
# uses the "listener" script to generate output.
#
PortNum=$1
printf "\n\tListening on port %d\n" "$PortNum"
#nc -l -p $PortNum -e listener #This works
nc -l -p $PortNum -e "listener $PortNum" #This doesn't
printf "\n\tClosing port %d\n\n" "$PortNum"