Comment by ๐Ÿฆ wasolili

Re: "Map hostnames to strings in config?"

In: s/bash

bash doesn't allow . in variables, but you could parse the config up front to build an associative array.

โ€” https://www.gnu.org/software/bash/manual/html_node/Arrays.html

after you build the hostmap associative array and parse the hostname out of the request you'd be able to do something like ${hostmap["$hostname"]} to access it

๐Ÿฆ wasolili [flaired user]

2025-02-17 ยท 1 year ago

Original Post

๐ŸŒ’ s/bash

๐Ÿš€ asdf:

Map hostnames to strings in config? โ€” Earlier today I wrote a post about a Nex server I wrote in bash (it doesn't have networking, but it will take input and respond to it the same way a Nex server would respond if it had gotten that input via TCP, which means if you make it accessible over a network by running something like "nc -lk 1900 -e ./script" it'll work as a regular Nex server), and I thought maybe I could try modifying the code to support the Spartan protocol. The Spartan protocol...

๐Ÿ’ฌ 1 comment ยท 1 like ยท 2025-02-16 ยท 1 year ago