Could someone please review my scripting and give me criticism?
I made a script to manage my dotfiles on linux (arch btw).
Link to repo
https://codeberg.org/Flan-Angel/Dawtfiles/src/branch/main
Link to script
https://codeberg.org/Flan-Angel/Dawtfiles/src/branch/main/PushToSYS.sh
Tysm if you do end up checking it out :)
https://redd.it/1s42scy
@r_bash
I made a script to manage my dotfiles on linux (arch btw).
Link to repo
https://codeberg.org/Flan-Angel/Dawtfiles/src/branch/main
Link to script
https://codeberg.org/Flan-Angel/Dawtfiles/src/branch/main/PushToSYS.sh
Tysm if you do end up checking it out :)
https://redd.it/1s42scy
@r_bash
Terminal Native API Testing Tool is LIVE!
https://preview.redd.it/gq2fehb401sg1.png?width=1233&format=png&auto=webp&s=84566c1673098db1088664090ad091e0c01a3a0d
Hey guys!
Rust based API Testing Tool is now live,
# Y'all can download it from here: Volt
This is a minimalistic API testing tool right in the terminal itself which has a blazingly fast response window. It scans source files and lists every route instantly — axum, express, fastapi, next.js, and more so that you do not need to write the Endpoints or Base URLs manually.
Do check it out and let me know your thoughts.
The Binaries are available for MacOS, Linux, and Windows on the website. Feel free to drop issues if you find any.
https://redd.it/1s72ksw
@r_bash
https://preview.redd.it/gq2fehb401sg1.png?width=1233&format=png&auto=webp&s=84566c1673098db1088664090ad091e0c01a3a0d
Hey guys!
Rust based API Testing Tool is now live,
# Y'all can download it from here: Volt
This is a minimalistic API testing tool right in the terminal itself which has a blazingly fast response window. It scans source files and lists every route instantly — axum, express, fastapi, next.js, and more so that you do not need to write the Endpoints or Base URLs manually.
Do check it out and let me know your thoughts.
The Binaries are available for MacOS, Linux, and Windows on the website. Feel free to drop issues if you find any.
https://redd.it/1s72ksw
@r_bash
AI written in BASH? It exists!
Someone actually created an AI (GPT) in BASH!
https://github.com/ResonantEntropy/bashGPT
It is not a wrapper around curl.. It's a full GPT!
LOL! This is intense!
https://redd.it/1s8hiwa
@r_bash
Someone actually created an AI (GPT) in BASH!
https://github.com/ResonantEntropy/bashGPT
It is not a wrapper around curl.. It's a full GPT!
LOL! This is intense!
https://redd.it/1s8hiwa
@r_bash
GitHub
GitHub - ResonantEntropy/bashGPT: An GPT created in BASH 4.x
An GPT created in BASH 4.x. Contribute to ResonantEntropy/bashGPT development by creating an account on GitHub.
for loop not indexing stuff in the {}'s
i can make a for loop like this
and get each value for the index printed on a separate line
but if i let
and try a loop like this
i get this output
is there no way to use a shell variable within the {}'s of a for loop?
https://redd.it/1sdcz2j
@r_bash
i can make a for loop like this
for i in {1..13} ; do
echo $i
done
and get each value for the index printed on a separate line
but if i let
len=13and try a loop like this
for i in {1..$len} ; do
echo $i
done
i get this output
{1..13}is there no way to use a shell variable within the {}'s of a for loop?
https://redd.it/1sdcz2j
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
This media is not supported in your browser
VIEW IN TELEGRAM
Free online editor where you can write Bash scripts, run them, take notes, and export to PDF
https://redd.it/1sd0v1g
@r_bash
https://redd.it/1sd0v1g
@r_bash
Clean WhatsApp messages
MYNAME="Homer Simpson" sed -E "s/^[[^]]+] ${MYNAME}: //" | sed -E "s/^[^]+] ^:+: /> /"
# Before
17:09, 4/5/2026 Homer Simpson: Nuclear plant back online!
17:09, 4/5/2026 Mr. Burns: Thank you for this. Who are you again?
17:10, 4/5/2026 Homer Simpson: Homer Simpson, sir 😅
# After
Nuclear plant back online!
> Thank you for this. Who are you again?
Homer Simpson, sir 😅
https://redd.it/1sdjuja
@r_bash
MYNAME="Homer Simpson" sed -E "s/^[[^]]+] ${MYNAME}: //" | sed -E "s/^[^]+] ^:+: /> /"
# Before
17:09, 4/5/2026 Homer Simpson: Nuclear plant back online!
17:09, 4/5/2026 Mr. Burns: Thank you for this. Who are you again?
17:10, 4/5/2026 Homer Simpson: Homer Simpson, sir 😅
# After
Nuclear plant back online!
> Thank you for this. Who are you again?
Homer Simpson, sir 😅
https://redd.it/1sdjuja
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
tool for helping me find commands
I've struggled a lot moving to linux from windows, and one of the things that has been a thorn in my side has been forgetting what commands to use, what they are called, and how to use them correctly.
Today I made myself this little tool to make life easier so I don't have to scroll through loads of 'man' pages just getting more confused. It's not a professional tool by any means, it was literally just made this morning to solve a basic problem, but I figured if it's useful for me it's probably useful to others too.
I am not great at linux, at software, at git, or anything like some people here, so don't tear me apart just because my tool sucks. I am aware. But it made my life easier, and i hope it will help others who are struggling.
https://github.com/koryfargodev/mytools
https://preview.redd.it/e3ezellgk7tg1.png?width=656&format=png&auto=webp&s=5446c86e4d8968a52859aa29ac328db7e68a1d96
https://redd.it/1scf9ss
@r_bash
I've struggled a lot moving to linux from windows, and one of the things that has been a thorn in my side has been forgetting what commands to use, what they are called, and how to use them correctly.
Today I made myself this little tool to make life easier so I don't have to scroll through loads of 'man' pages just getting more confused. It's not a professional tool by any means, it was literally just made this morning to solve a basic problem, but I figured if it's useful for me it's probably useful to others too.
I am not great at linux, at software, at git, or anything like some people here, so don't tear me apart just because my tool sucks. I am aware. But it made my life easier, and i hope it will help others who are struggling.
https://github.com/koryfargodev/mytools
https://preview.redd.it/e3ezellgk7tg1.png?width=656&format=png&auto=webp&s=5446c86e4d8968a52859aa29ac328db7e68a1d96
https://redd.it/1scf9ss
@r_bash
GitHub
GitHub - koryfargodev/mytools: Simple CLI tool to browse and search Linux commands with examples
Simple CLI tool to browse and search Linux commands with examples - koryfargodev/mytools
Is using $SHLVL a good way to tell if a script is running in a terminal window?
So, I want to make it so that a script I'm running will ONLY run in a terminal emulator window, and will sleep for 3 seconds then exit if it's not in a terminal emulator window. I've done a little bit of looking, but I'm not entirely sure if it would work as I intend, and if there are ways in which it could fail/if there are more reliable methods.i was thinking of something along the lines of:
If $SHLVL > 1 then
Echo running in terminal
Echo continuing
Elif $SHLVL =< 1 then
Sleep 3
Exit
Else
Echo how is this even possible?
Fi
(Obviously that's not correct syntax, it's just the general structure/idea of what I want to do) I'm not at my PC rn (on a road trip) but I'm trying to write a general test script on my phone that I can test on my PC once I return home.
Edit: to clarify I should mention that I'm on Debian x86_64, and when I say "in a terminal window" I mean that it's running with stout and sterr being displayed on a terminal emulator window, and stdin being read from the terminal emulator window.
https://redd.it/1schwjv
@r_bash
So, I want to make it so that a script I'm running will ONLY run in a terminal emulator window, and will sleep for 3 seconds then exit if it's not in a terminal emulator window. I've done a little bit of looking, but I'm not entirely sure if it would work as I intend, and if there are ways in which it could fail/if there are more reliable methods.i was thinking of something along the lines of:
If $SHLVL > 1 then
Echo running in terminal
Echo continuing
Elif $SHLVL =< 1 then
Sleep 3
Exit
Else
Echo how is this even possible?
Fi
(Obviously that's not correct syntax, it's just the general structure/idea of what I want to do) I'm not at my PC rn (on a road trip) but I'm trying to write a general test script on my phone that I can test on my PC once I return home.
Edit: to clarify I should mention that I'm on Debian x86_64, and when I say "in a terminal window" I mean that it's running with stout and sterr being displayed on a terminal emulator window, and stdin being read from the terminal emulator window.
https://redd.it/1schwjv
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Why does grep .* skip . and .. in ls -a output?
Let me clarify the situation first. As we know `ls -a` shows all files including `.` (current directory) and `..` (parent directory).
And If we want to print only the hidden files excluding `.` and `..` . We can run `echo .[!.]*` , and we can also use `ls -A | grep .*` it will not look as clean as `echo .[!.]*` but works. and I used `-A` because it already excludes `.` and `..` .
But i suppose If I run `ls -a | grep .*` , shouldn’t it also show `.` and `..`? But It doesn’t, those two entries are missing as if I'm using `-A` .
Am I misunderstanding how `grep .*` behaves here?
Be kind please even if it's something obvious, the noob is still learning.
https://redd.it/1sbuopd
@r_bash
Let me clarify the situation first. As we know `ls -a` shows all files including `.` (current directory) and `..` (parent directory).
And If we want to print only the hidden files excluding `.` and `..` . We can run `echo .[!.]*` , and we can also use `ls -A | grep .*` it will not look as clean as `echo .[!.]*` but works. and I used `-A` because it already excludes `.` and `..` .
But i suppose If I run `ls -a | grep .*` , shouldn’t it also show `.` and `..`? But It doesn’t, those two entries are missing as if I'm using `-A` .
Am I misunderstanding how `grep .*` behaves here?
Be kind please even if it's something obvious, the noob is still learning.
https://redd.it/1sbuopd
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
How declarative can bash scripts get?
I'm doing sanity testing of containers using bash and wonder how close I can get bash to the testing workflow of tools like Playwright.
For example. Here is my current script for 1 sanity test
#!/bin/bash
set -euo pipefail
PASS=0
FAIL=0
GREEN='\0330;32m'
RED='\033[0;31m'
RESET='\033[0m'
ok() {
echo -e " ${GREEN}[PASS${RESET} $"
((++PASS))
}
fail() {
echo -e " ${RED}[FAIL]${RESET} $"
((++FAIL))
}
echo ""
echo "=== 1. Container status ==="
if podman inspect "$CONTAINER" --format '{{.State.Running}}' 2>/dev/null | grep -q true; then
ok "Container '$CONTAINER' is running"
else
fail "Container '$CONTAINER' is NOT running"
fi
Here's my first attempt at making it more declarative:
describe() {
echo ""
echo "--- $1 ---"
}
it() {
local title=$1
shift
if "$@"; then ok "$title"; else fail "$title"; fi
}
containerisrunning() {
podman inspect "$CONTAINER" --format '{{.State.Running}}' 2>/dev/null | grep -q true
}
describe "Container"
it "container '$CONTAINER' is running" podman inspect "$CONTAINER" --format '{{.State.Running}}' 2>/dev/null | grep -q true
Ultimately, i'm not going to go with the second style since it it's not that readable. I can't pass the function body as an arugment as you'd do in JS and the alternatives (eval) will make the code worse.
Before I chuck this whole concept down, I thought I'd make a post and see if thats really impossible in Bash, or I may be missing something.
https://redd.it/1sahl6s
@r_bash
I'm doing sanity testing of containers using bash and wonder how close I can get bash to the testing workflow of tools like Playwright.
For example. Here is my current script for 1 sanity test
#!/bin/bash
set -euo pipefail
PASS=0
FAIL=0
GREEN='\0330;32m'
RED='\033[0;31m'
RESET='\033[0m'
ok() {
echo -e " ${GREEN}[PASS${RESET} $"
((++PASS))
}
fail() {
echo -e " ${RED}[FAIL]${RESET} $"
((++FAIL))
}
echo ""
echo "=== 1. Container status ==="
if podman inspect "$CONTAINER" --format '{{.State.Running}}' 2>/dev/null | grep -q true; then
ok "Container '$CONTAINER' is running"
else
fail "Container '$CONTAINER' is NOT running"
fi
Here's my first attempt at making it more declarative:
describe() {
echo ""
echo "--- $1 ---"
}
it() {
local title=$1
shift
if "$@"; then ok "$title"; else fail "$title"; fi
}
containerisrunning() {
podman inspect "$CONTAINER" --format '{{.State.Running}}' 2>/dev/null | grep -q true
}
describe "Container"
it "container '$CONTAINER' is running" podman inspect "$CONTAINER" --format '{{.State.Running}}' 2>/dev/null | grep -q true
Ultimately, i'm not going to go with the second style since it it's not that readable. I can't pass the function body as an arugment as you'd do in JS and the alternatives (eval) will make the code worse.
Before I chuck this whole concept down, I thought I'd make a post and see if thats really impossible in Bash, or I may be missing something.
https://redd.it/1sahl6s
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
cURL file upload patterns - multipart, batch uploads, xargs, and piping from stdin
Kept re googling the same cURL commands for uploading files, so I put everything in one place.
Covers:
\- Basic upload with -F
\- Auth headers and API keys
\- Looping through a directory
\- Parallel uploads with xargs
\- Piping tar output directly into an upload endpoint
\- What -F, -H, -X, -o, and --max-time actually do
\- Common errors like 413, 401, and 400, plus how to fix them
https://filepost.dev/blog/how-to-upload-files-with-curl
Hopefully this saves someone else the same trial and error.
https://redd.it/1sdvw2w
@r_bash
Kept re googling the same cURL commands for uploading files, so I put everything in one place.
Covers:
\- Basic upload with -F
\- Auth headers and API keys
\- Looping through a directory
\- Parallel uploads with xargs
\- Piping tar output directly into an upload endpoint
\- What -F, -H, -X, -o, and --max-time actually do
\- Common errors like 413, 401, and 400, plus how to fix them
https://filepost.dev/blog/how-to-upload-files-with-curl
Hopefully this saves someone else the same trial and error.
https://redd.it/1sdvw2w
@r_bash
FilePost
Upload Files with cURL: API Examples & One-Liners
Upload files with cURL using one-liners you can copy-paste. Covers multipart uploads, API key auth, multiple files, piping, and common flags like -F and -H.
Best learning resource
Dear Linux administrators, how did you learn bash and bash scripting and what are the best ways you’ve used bash in enterprise environments? Give some examples of how you’ve used bash in server side scripting, infrastructure operations and automation and tell us what resources did you use to learn as a beginner to get to where you are now?
https://redd.it/1sdz4k9
@r_bash
Dear Linux administrators, how did you learn bash and bash scripting and what are the best ways you’ve used bash in enterprise environments? Give some examples of how you’ve used bash in server side scripting, infrastructure operations and automation and tell us what resources did you use to learn as a beginner to get to where you are now?
https://redd.it/1sdz4k9
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Shell function for installing/removing packages using fzf!
A shell function for removing/installing packages from AUR, system repos and flatpak mainly only using
https://redd.it/1se2jym
@r_bash
A shell function for removing/installing packages from AUR, system repos and flatpak mainly only using
fzf as dependency. Should work with most Arch Linux based distros(I am on CachyOS and works perfectly) if you have fzf, yay installed and AUR enabled :)mngpkg() {
local selections=$( (
yay -Slq | awk '{print "[yay-ins] " $1}' &
flatpak remote-ls flathub --columns=application | awk '{print "[flt-ins] " $1}' &
pacman -Qq | awk '{print "[yay-rm] " $1}' &
flatpak list --app --columns=application | awk '{print "[flt-rm] " $1}' &
wait
) | fzf --multi --header 'Search All Repos & Installed Apps (Tab to select)' \
--preview '
tag=$(echo {} | awk "{print \$1}");
pkg=$(echo {} | awk "{print \$2}");
if [ "$tag" = "[yay-ins]" ]; then
yay -Si "$pkg"
elif [ "$tag" = "[yay-rm]" ]; then
pacman -Qi "$pkg"
elif [ "$tag" = "[flt-ins]" ]; then
flatpak remote-info flathub "$pkg"
elif [ "$tag" = "[flt-rm]" ]; then
flatpak info "$pkg"
fi
' )
[ -z "$selections" ] && return
local yay_in=$(echo "$selections" | grep '^\[yay-ins\]' | awk '{print $2}')
local flat_in=$(echo "$selections" | grep '^\[flt-ins\]' | awk '{print $2}')
local yay_rm=$(echo "$selections" | grep '^\[yay-rm\]' | awk '{print $2}')
local flat_rm=$(echo "$selections" | grep '^\[flt-rm\]' | awk '{print $2}')
if [ -n "$yay_rm" ] || [ -n "$flat_rm" ]; then
printf "Delete app data and configuration files for removed packages? (y/N): "
read -r delete_data
fi
if [ -n "$yay_rm" ]; then
if [[ "$delete_data" =~ ^[Yy]$ ]]; then
echo "$yay_rm" | xargs -ro sudo pacman -Rns
else
echo "$yay_rm" | xargs -ro sudo pacman -Rs
fi
fi
if [ -n "$flat_rm" ]; then
if [[ "$delete_data" =~ ^[Yy]$ ]]; then
echo "$flat_rm" | xargs -ro flatpak uninstall --delete-data
else
echo "$flat_rm" | xargs -ro flatpak uninstall
fi
fi
if [ -n "$yay_in" ]; then
echo "$yay_in" | xargs -ro yay -S
fi
if [ -n "$flat_in" ]; then
echo "$flat_in" | xargs -ro flatpak install flathub
fi
}
https://redd.it/1se2jym
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Chronically - Interactive system administration CLI
https://github.com/fieldghost/Chronically
https://redd.it/1se9py7
@r_bash
https://github.com/fieldghost/Chronically
https://redd.it/1se9py7
@r_bash
GitHub
GitHub - fieldghost/Chronically: Help scheduling crontab without having to remember that stupid crontab syntax
Help scheduling crontab without having to remember that stupid crontab syntax - fieldghost/Chronically
Hi - sharing a tool where you can expose Bash commands with guardrails
https://redd.it/1sfxbf9
@r_bash
https://redd.it/1sfxbf9
@r_bash