r_bash – Telegram
UTKeeper99 a advanced Linux Unreal Tournament and Webservices Tool

\# Features Highlights:

\# - First-Run Auto-Config Detection (should reject critical system paths)

\# - DryRun Mode for safe testing

\# - Recursive Archive Extraction (up to 10 levels deep)

\# - Smart File Collection (gathers all UT files from subdirs)

\# - Disk Space Validation before Backup

\# - Backup Management (List, Delete by age, etc.)

\# - Distribution of Maps to UT Server and Webserver

\# - Cloning Maps (you like CTF-Face? or a MH Map ? now play that as DM/TDM map)

\# - Name fixes (case sensitive for Linux) + chmod/chown defaults for UT/Web

\# - Advanced UT and Webserver Orphan Cleaning Tool

\# - Modular design for easy expansion/customization.

\#







https://github.com/KoDProm/utkeeper99

https://redd.it/1qq6ewo
@r_bash
Limiting internet access on machine through BASH

Okay, I have NO idea where to post this now. Please, if this is NOT relevant to this subreddit, could anyone direct me to an appropriate subreddit.


If anyone can solve it, I will be so grateful!



I am trying to limit internet on my maching from 8AM to 10PM via powershell. I used GPT to help.

So here are some commands that work

To create internet kill switch on laptop:

netsh advfirewall firewall add rule name="InternetKillSwitch" dir=out action=block protocol=any

To kill internet on laptop (test to show that it work)

netsh advfirewall firewall set rule name="InternetKillSwitch" new enable=yes

To enable internet on laptop (test to show that it works)

netsh advfirewall firewall set rule name="InternetKillSwitch" new enable=no

However, the following does not work. I assume that it doesn't work when the machine is off.

To UNblock internet at 8:00AM, task called "EnableInternet"

schtasks /create /sc daily /st 08:00 /ru SYSTEM /rl HIGHEST /tn "EnableInternet" /tr "powershell -command \"netsh advfirewall firewall set rule name='InternetKillSwitch' new enable=no\""

I tried to edit it so that it checks the time every minute. That way if the machine is turned on AFTER 8AM, it works. But the following does NOT work

schtasks /create /sc daily /st 08:00 /ru SYSTEM /rl HIGHEST /tn "EnableInternet" /tr "powershell -command \"netsh advfirewall firewall set rule name='InternetKillSwitch' new enable=no\"" /ri 1 /du 24:00



Similar for blocking the internet at midday.

schtasks /create /sc daily /st 12:00 /ru SYSTEM /rl HIGHEST /tn "EnableInternet" /tr "powershell -command \"netsh advfirewall firewall set rule name='InternetKillSwitch' new enable=no\"" /ri 1 /du 24:00



I bet there are other issues, Like if both commands even worked, maybe the internet would just switch on and off?


I am so lost here guys, let me know if you have any solutions.


Inb4 why not just remove the internet: I only need the internet between 8AM and midday.

https://redd.it/1qqoyt0
@r_bash
How to kill a noscript after it runs awhile from another noscript

Hi,

I have a noscript that runs on startup that I will want to kill to run another one(later on) via cron.

Can't figure out how to kill the first noscript programatically.

Say the noscript is: ~/noscripts/default.sh

and I want to kill it, what is a predictable way to kill said noscript. I know of ps and pkill but I hit a wall. I don't know the steps(or commands?) involved to do this accurately.

Thanks in advance.

https://redd.it/1qowblg
@r_bash
SS64

I've been using the command line for 26 years and I've seen lots of good tips and tricks guides. My favorite by far is ss64.com. I actually originally found it when I was looking for help with Windows batch noscripting, but it has good stuff about Linux and Bash, too.

https://redd.it/1qo2bp1
@r_bash
Code Optimization Suggestions Welcome

Howdy bash friends,

Inspired by the goodwork of people in the ZSA and ploopy communities I whipped together some improvements to the moonlander (keyboard) spin of the ploopy nano (trackball) BTU mod, and I wrote a little noscript and a systemd .service file that use the api ZSA made to manage communication between the trackball and my moonlander, so that moving the trackball activates a mouse layer on my keyboard,

Honestly it's pretty sweet, very snappy and responsive, but I was wondering if some bored soul with a deep knowledge of bash built-in's was willing to take a look and let me know if I missed some low-hanging fruit to optimize my code?

https://preview.redd.it/lgbguzx6jmfg1.jpg?width=4624&format=pjpg&auto=webp&s=57ee3e3b9a0c65e30634b982aed7fb23106a1b1a

Posted on github here

https://redd.it/1qn6hkf
@r_bash
Format curl output

-w for curl can output values like request size. I am printing a few numbers like -w %num_redirects %num_retries. Does it let you format the output with padding how printf has %05d?

https://redd.it/1qmprj1
@r_bash
FUN.bash

I made public an configuration and function framework I've been using in bash for quite some time already. Do check out :)

Constructive criticism very welcome. Basically what it has is templates and you can have loadable modules for your own functions. A lot can be achieved probably with aliases and some other tools, but I have had fun with this one.

https://github.com/nuin-ctrl/FUN.bash

https://redd.it/1qsuy3g
@r_bash
The BASH Reference Manual is part of The Epstein Files.
https://redd.it/1qvml6o
@r_bash
Nix: Defining Dependencies with Flakes

What do you think about that? What do you want to add?

## Nix: Defining Dependencies with Flakes

In the Python world, we have virtual environments. They are incredibly handy because they allow you to maintain multiple environments, each with its own custom dependencies and specific versions.

Almost every programming language has a similar concept, but what about Bash noscripts? While you can manually modify your PATH—and for small projects, that might work—it quickly becomes difficult to manage.

If you want a declarative way to define dependencies, Nix Flakes is the best solution I’ve found.

Admittedly, some parts of Nix can be difficult for newcomers to grasp. However, Large Language Models (LLMs) and your favorite search engine support you.

Personally, I think it’s time to say "goodbye" to Makefiles and noscripts that manually install tools.

Should you install everything via Nix?

My approach is to install the base tools via Nix and then let language-specific package managers handle the version pinning:

Go: `go.mod` / `go.sum`
JS: package.json / package-lock.json
Ruby: `Gemfile` / `Gemfile.lock`
....


https://redd.it/1qwfcnv
@r_bash
Is there a program to compress a shell noscript?

Is there a program that allows to "compile" a shell noscript to a file that still can be run by the normal shell interpreter, but is as small as possible in size? With measures like

* All indentation and comments removed
* Variables and functions renamed to one and two letter words
* Frequently used pieces of code assigned to aliases / variables

All I can find with google are common data compressors, like .zip.

https://redd.it/1qv2920
@r_bash
just exits the loop without any errors

https://preview.redd.it/ptw8jomon7hg1.png?width=1920&format=png&auto=webp&s=aacffd63ff1ea164ad69ea0da23d878b6cd99e12

is this bash bug?

it exits well for "unbound variable"

but for bad number just stops the loop, exactly like `break` called without any errors that I can catch, it reaches "we never got error",
this should be impossible to reach

zsh (on the right) does not behave the same way


and the noscript:

#!/bin/bash
set -eu # set or unset. does not make a difference


declare -i myint=8
for i; do

(exit 77)

echo handling: i=$i || exit 11
myint=$i || exit 22
echo good: "myint=${myint}" || exit 33

exit 55

done || echo loop got error: $?

echo we never got error


(
{
declare -i myint=8
for i; do

(exit 77)

echo handling: i=$i || exit 11
myint=$i || exit 22
echo good: "myint=${myint}" || exit 33

exit 55

done || echo loop got error: $?

echo NOW WE DONT REACH THIS LINE

} || echo NOT HERE: $?
) || echo BUT HERE WE FINALLY GET ERROR: $?

ignore the (exit 77) I was testing if it'll exit from the loop when have set -e

https://redd.it/1quj2f4
@r_bash
robohelp - A Fast & Friendly CLI for Linux!

Introducing robohelp - A Fast & Friendly CLI for Linux!

At the moment im building robohelp (not to be confused with adobe's robohelp), a lightweight command-line utility designed to make system maintenance on different Linux distributions faster and easier. Whether you’re updating packages, cleaning up unused stuff, or automating routine tasks, robohelp does it with a simple set of commands.

I tryed to build it with simplicity and efficiency in mind, robohelp makes your everyday Linux tasks smoother (hopefully).

Check it out on GitHub: https://github.com/H14d3n/robohelp

Hope you like it and if you want, you can leave a review down below.

https://redd.it/1qwl8mo
@r_bash
A Bash wrapper I wrote to manage multiple Docker Compose projects (looking for feedback)

I’ve been running into the same annoyance on servers and homelab machines: managing a growing number of unrelated Docker Compose projects spread across different directories.

Rather than relying on aliases or strict directory conventions, I ended up writing a small Bash wrapper that lets me refer to Compose projects by name and run `docker compose` commands from anywhere.

Example usage:

dcompose media
dlogs website
ddown backup

From a Bash perspective, the noscript:

* auto-discovers Compose projects in a set of common base directories
* keeps a simple registry file for manually added paths
* is pure Bash
* is meant to work well over SSH and on servers
* tries to keep error messages and output readable in a terminal

Repo is here if you want to look at the noscript:
[https://github.com/kyanjeuring/dstack](https://github.com/kyanjeuring/dstack)

Happy to hear feedback.

https://redd.it/1qwrwkh
@r_bash
A case study in why learning regex is important
https://redd.it/1qwxzp3
@r_bash
Thoughts from a system engineer that became a developer

Coding is a craft. At least, that's what it is for me.

I'm continuing my project of documenting my experience as I revisit Bash after years spent as a full-time developer. Can we apply the same mindset we use for complex software project to simple noscripts? Is there a benefit?

I wrote an article about how acquiring a testing mindset can help writing better code, even if at the end you write no test at all (you can read it here, if you like).

Feedback is appreciated.

Happy coding.

https://redd.it/1qwzx5p
@r_bash