Server Talk > Scripting Releases

Soldat Shell - Shell (Bash and Csh) scripts for Soldat dedicated servers.

<< < (2/3) > >>

Savage:
Backticks are old and some shenanigans can happen with them and they are still there only for backward compatibility afaik.

jrgp:

--- Quote from: Savage on June 10, 2021, 12:36:09 pm ---Backticks are old and some shenanigans can happen with them and they are still there only for backward compatibility afaik.

--- End quote ---

To be fair, that's most of Unix and computing in general.

Personally, I think backticks are cooler and I usually go for them first, and then switch to $( ) when I need to nest something.

BlackFire533:

--- Quote from: jrgp on June 10, 2021, 01:28:22 am ---Instead, why not find a way to pass netcat's stdin and stdout to your script's stdin and stdout, and operate on incoming lines as you receive them, using `while read line` or similar? That way you aren't busy waiting (as each loop iteration will block on reading an incoming message), won't drop messages, and will consume far fewer resources.

--- End quote ---
I have done what you suggested and seems to be working well. As a side note, since netcat cannot run programs within a socket, I had to use socat to attach stdin and stdout to the script. Busybox's netcat and Nmap's Ncat are two other options, but I did not opt to use them, since socat is more of a complete, advanced tool and I'm mostly used to it.
I will upload the sources to GitHub as soon as I reimplement the other scripts (have reimplemented only rcon_commands as of now).

BlackFire533:
NEW: Ported to C Shell. (Still need to work on rcon_kills and rcon_commands.)
[As of now, all scripts have been ported.]

The C Shell is powerful, more reliable and suitable for this project.
The code relies in the same repository, but in a new branch.
https://github.com/Krush206/soldat-shell/tree/csh

BlackFire533:
Some might wonder, "Why C Shell?"
Various reasons: C-like syntax, better built-ins, better scripting, a rich set of mathematical and logical operators, many convenient features (auto-correct, history substitution, built-in math).
It's also very secure; being "limited" makes it secure. (E.g: Nesting is minimal, thus preventing Shell injections at all costs; there are better ways to achieve what one want.)

The C Shell teaches how to safely write scripts. It's very cool. :)
The limitations aren't drawbacks.
http://parallel.vub.ac.be/documentation/linux/unixdoc_download/Scripts.html

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version