Most hidden "bug"?
Edit: Ok, maybe the post noscript is a bit pretentious, in hindsight even cringe (cannot edit it anymore). But the behavior is certainly weird!
I've found something truly weird, and maybe someone knowledgeable in bash's source code can help me understand this :D. If you run this command: `a(`, you will likely get ``bash: syntax error near unexpected token `newline'``. Now, run this command `<(`. It will hopefully ask for more input. Abort with Ctrl-C. Now run `a(` again. You will *from now on*, get a different error message! Namely: ``bash: syntax error near unexpected token `newline' while looking for matching `)'``.
Of course this is a niche thing that doesn't really matter, but I'm really interested in bash and maybe someone has a sound explanation for this, as it doesn't really make sense to me. It seems like bash turns a switch or something when you start but not finish a process substitution!
Here's an interactive session of what I mean:
$ a(
bash: syntax error near unexpected token `newline'
$ a((
bash: syntax error near unexpected token `('
$ <(
> ^C
$ a(
bash: syntax error near unexpected token `newline' while looking for matching `)'
$ a((
bash: syntax error near unexpected token `(' while looking for matching `)'
$ a(
bash: syntax error near unexpected token `newline' while looking for matching `)'
https://redd.it/1qly1ha
@r_bash
Edit: Ok, maybe the post noscript is a bit pretentious, in hindsight even cringe (cannot edit it anymore). But the behavior is certainly weird!
I've found something truly weird, and maybe someone knowledgeable in bash's source code can help me understand this :D. If you run this command: `a(`, you will likely get ``bash: syntax error near unexpected token `newline'``. Now, run this command `<(`. It will hopefully ask for more input. Abort with Ctrl-C. Now run `a(` again. You will *from now on*, get a different error message! Namely: ``bash: syntax error near unexpected token `newline' while looking for matching `)'``.
Of course this is a niche thing that doesn't really matter, but I'm really interested in bash and maybe someone has a sound explanation for this, as it doesn't really make sense to me. It seems like bash turns a switch or something when you start but not finish a process substitution!
Here's an interactive session of what I mean:
$ a(
bash: syntax error near unexpected token `newline'
$ a((
bash: syntax error near unexpected token `('
$ <(
> ^C
$ a(
bash: syntax error near unexpected token `newline' while looking for matching `)'
$ a((
bash: syntax error near unexpected token `(' while looking for matching `)'
$ a(
bash: syntax error near unexpected token `newline' while looking for matching `)'
https://redd.it/1qly1ha
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Are there any high leverage ways to get good ctrl r in a terminal?
I have to deal with a lot of minimal containers. Some, I straight up don't control (proprietary cloud simulations). Some I do control technically... but it's a PITA to maintain all my configs and integrate them with the container easily and reliably (especially if dependencies aren't installed on said machine), through version upgrades. Sometimes I just want to spin up a container just cuz.
For reference, another extremely high leverage option is vi mode:
I just copy this in the start of any minimal bash session (or even just set -o vi, but this is automatable with tmux) and I'm basically chilling.
Sure, fzf is great, but it depends on git being installed. I mean, not really a big deal, but still, a dependency (e.g. now you need internet access, remember the package manager for the OS, it needs to have git, etc.) Furthermore, I want to sort of push the limits of bash - are there any wizards that know a lot about obscure bash features that could hack something up that's "simple" (two stages: one is obviously just minimal characters, but any solution that you can just copy paste into a bash terminal in a single line, no matter how hackily, is good enough for me IMO)
Yes, I know normal ctrl r, no, I don't like it mainly because it doesn't show me multiple options at once. My memory is really bad LOL, but maybe I just get used to it (fzf is an actual gamechanger fr tho)
---
EDIT because I think i'm shadowbanned from my own post for some reason but:
the use case is when you spin up various interactive containers potentially hundreds of times a day, don't have control over the exact launch params (or more precisely, maintaining custom configs layered on top of the containers is either hacky as version upgrades happen, or it straight up is impossible like in secure proprietary cloud simulations) and don't want to deal with vanilla bash.
the challenge is to find a good balance
my config in general (if I were say, installing configs fully on a home computer I control) is already very minimal already, but this is going even further.
in general:
- mounting is forbidden in general (if I could mount, I'd just install my configs lol)
- internet is okay, but the point is no internet. yes I am aware git clone fzf + install, the point of the post is that we aren't going this route. take it or leave it lol. that's why I asked specifically on the r/bash subreddit, if there were any bash wizards who had custom ctrl R setups, curious
set -o vi, for example, is a setting on most containers that exists, requires no internet, and is high leverage for me (as someone who lives perma in the command line).
fzf is also very high leverage for me. but I'm saying, assume we aren't allowed to use fzf, what can we do
https://redd.it/1qqo2ce
@r_bash
I have to deal with a lot of minimal containers. Some, I straight up don't control (proprietary cloud simulations). Some I do control technically... but it's a PITA to maintain all my configs and integrate them with the container easily and reliably (especially if dependencies aren't installed on said machine), through version upgrades. Sometimes I just want to spin up a container just cuz.
For reference, another extremely high leverage option is vi mode:
set -o vi; bind 'set vi-ins-mode-string \1\e[6 q\2'; bind 'set vi-cmd-mode-string \1\e[2 q\2';
I just copy this in the start of any minimal bash session (or even just set -o vi, but this is automatable with tmux) and I'm basically chilling.
Sure, fzf is great, but it depends on git being installed. I mean, not really a big deal, but still, a dependency (e.g. now you need internet access, remember the package manager for the OS, it needs to have git, etc.) Furthermore, I want to sort of push the limits of bash - are there any wizards that know a lot about obscure bash features that could hack something up that's "simple" (two stages: one is obviously just minimal characters, but any solution that you can just copy paste into a bash terminal in a single line, no matter how hackily, is good enough for me IMO)
Yes, I know normal ctrl r, no, I don't like it mainly because it doesn't show me multiple options at once. My memory is really bad LOL, but maybe I just get used to it (fzf is an actual gamechanger fr tho)
---
EDIT because I think i'm shadowbanned from my own post for some reason but:
the use case is when you spin up various interactive containers potentially hundreds of times a day, don't have control over the exact launch params (or more precisely, maintaining custom configs layered on top of the containers is either hacky as version upgrades happen, or it straight up is impossible like in secure proprietary cloud simulations) and don't want to deal with vanilla bash.
the challenge is to find a good balance
my config in general (if I were say, installing configs fully on a home computer I control) is already very minimal already, but this is going even further.
in general:
- mounting is forbidden in general (if I could mount, I'd just install my configs lol)
- internet is okay, but the point is no internet. yes I am aware git clone fzf + install, the point of the post is that we aren't going this route. take it or leave it lol. that's why I asked specifically on the r/bash subreddit, if there were any bash wizards who had custom ctrl R setups, curious
set -o vi, for example, is a setting on most containers that exists, requires no internet, and is high leverage for me (as someone who lives perma in the command line).
fzf is also very high leverage for me. but I'm saying, assume we aren't allowed to use fzf, what can we do
https://redd.it/1qqo2ce
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Locked out of local admin account - need to recover Wi-Fi network details
Hi everyone,
I’ve found my old laptop running Windows 10/11, but I’ve completely forgotten the local administrator password. I can log in as a standard user, but I need admin rights to see the Wi-Fi password for the network I'm currently connected to (using the netsh wlan show profile command).
Since it’s a local account not linked to Microsoft, I’m looking for a way to reset the admin password or gain enough privileges to run CMD as admin without wiping my data. Are tools like Hiren’s BootCD or the "utilman" method still working on recent updates?
Thanks for any advice!
https://redd.it/1qqyc1c
@r_bash
Hi everyone,
I’ve found my old laptop running Windows 10/11, but I’ve completely forgotten the local administrator password. I can log in as a standard user, but I need admin rights to see the Wi-Fi password for the network I'm currently connected to (using the netsh wlan show profile command).
Since it’s a local account not linked to Microsoft, I’m looking for a way to reset the admin password or gain enough privileges to run CMD as admin without wiping my data. Are tools like Hiren’s BootCD or the "utilman" method still working on recent updates?
Thanks for any advice!
https://redd.it/1qqyc1c
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Tcl: The Most Underrated, But The Most Productive Programming Language (like Bash)
https://medium.com/gitconnected/tcl-the-most-underrated-but-the-most-productive-programming-language-1f83c99eaab7?sk=de732f41d473339dc31ee7481a8ba526
https://redd.it/1qqyq44
@r_bash
https://medium.com/gitconnected/tcl-the-most-underrated-but-the-most-productive-programming-language-1f83c99eaab7?sk=de732f41d473339dc31ee7481a8ba526
https://redd.it/1qqyq44
@r_bash
Medium
Tcl: The Most Underrated, But The Most Productive Programming Language
The only well-modernized command language that you can use literally for anything
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
\# 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
GitHub
GitHub - KoDProm/utkeeper99: UTKeeper99 a linux based Unreal Tournament and local Webdirect Management Service Tool
UTKeeper99 a linux based Unreal Tournament and local Webdirect Management Service Tool - KoDProm/utkeeper99
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:
To kill internet on laptop (test to show that it work)
To enable internet on laptop (test to show that it works)
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"
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
Similar for blocking the internet at midday.
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
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=anyTo kill internet on laptop (test to show that it work)
netsh advfirewall firewall set rule name="InternetKillSwitch" new enable=yesTo enable internet on laptop (test to show that it works)
netsh advfirewall firewall set rule name="InternetKillSwitch" new enable=noHowever, 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:00Similar 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:00I 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
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
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
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
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
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
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
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
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
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
https://redd.it/1qmprj1
@r_bash
-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
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
A simple noscript to route between different llm providers and models
https://github.com/Jevs21/bash-ai
https://redd.it/1qskmov
@r_bash
https://github.com/Jevs21/bash-ai
https://redd.it/1qskmov
@r_bash
GitHub
GitHub - Jevs21/bash-ai: To easily route between different providers and models
To easily route between different providers and models - Jevs21/bash-ai
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
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
GitHub
GitHub - nuin-ctrl/FUN.bash: Bash function module framework
Bash function module framework. Contribute to nuin-ctrl/FUN.bash development by creating an account on GitHub.
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
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:
Ruby: `Gemfile` / `Gemfile.lock`
....
https://redd.it/1qwfcnv
@r_bash
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.jsonRuby: `Gemfile` / `Gemfile.lock`
....
https://redd.it/1qwfcnv
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
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
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
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
guys you should read the bash manual
https://www.justice.gov/epstein/files/DataSet%209/EFTA00315849.pdf
epstein got y'all covered
https://redd.it/1quky48
@r_bash
https://www.justice.gov/epstein/files/DataSet%209/EFTA00315849.pdf
epstein got y'all covered
https://redd.it/1quky48
@r_bash
Reddit
From the bash community on Reddit: guys you should read the bash manual
Explore this post and more from the bash community
FOSDEM 2026 - Amber Lang - Easily write Bash with a transpiler
https://fosdem.org/2026/schedule/event/GGLZS9-amber-lang-bash-transpiler/
https://redd.it/1quvf5w
@r_bash
https://fosdem.org/2026/schedule/event/GGLZS9-amber-lang-bash-transpiler/
https://redd.it/1quvf5w
@r_bash
fosdem.org
FOSDEM 2026 - Amber Lang - Easily write Bash with a transpiler
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
https://redd.it/1quj2f4
@r_bash
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 -ehttps://redd.it/1quj2f4
@r_bash