Concurrency and Strict Mode
I added a chapter about Bash and Concurrency in my small Bash Strict Mode Guide:
https://github.com/guettli/bash-strict-mode?tab=readme-ov-file#general-bash-hints-concurrency
Feedback is welcome:
## General Bash Hints: Concurrency
If you want to execute two tasks concurrently, you can do it like this:
Why wait each PID separately?
- You must wait to reap background children and avoid zombies.
-
waited for. This means an earlier background job can fail yet the combined
success if the last job succeeds — not what you want if you need to detect failures reliably.
https://redd.it/1p20iz7
@r_bash
I added a chapter about Bash and Concurrency in my small Bash Strict Mode Guide:
https://github.com/guettli/bash-strict-mode?tab=readme-ov-file#general-bash-hints-concurrency
Feedback is welcome:
## General Bash Hints: Concurrency
If you want to execute two tasks concurrently, you can do it like this:
# Bash Strict Mode: https://github.com/guettli/bash-strict-mode
trap 'echo -e "\n🤷 🚨 🔥 Warning: A command has failed. Exiting the noscript. Line was ($0:$LINENO): $(sed -n "${LINENO}p" "$0" 2>/dev/null || true) 🔥 🚨 🤷 "; exit 3' ERR
set -Eeuo pipefail
{
echo task 1
sleep 1
} & task1_pid=$!
{
echo task 2
sleep 2
} & task2_pid=$!
# Wait each PID on its own line so you get each child's exit status.
wait "$task1_pid"
wait "$task2_pid"
echo end
Why wait each PID separately?
- You must wait to reap background children and avoid zombies.
-
wait pid1 pid2 will wait for both PIDs, but its exit status is the exit status of the last PIDwaited for. This means an earlier background job can fail yet the combined
wait can still returnsuccess if the last job succeeds — not what you want if you need to detect failures reliably.
https://redd.it/1p20iz7
@r_bash
GitHub
GitHub - guettli/bash-strict-mode: Bash Strict Mode
Bash Strict Mode. Contribute to guettli/bash-strict-mode development by creating an account on GitHub.
how do you manage your .bashrc and ,bashprofile
Hi
I'm looking at puppet and setting up standard alias and other things
I don't really want to take over \~/.bashrc or \~/.bash\profile
I was thinking maybe the way to do this was to add at the bottom
. (or source) \~/.bashrc-puppet
and
. (or source) \~/.bashrc-local
so that what files or other things can add / remove lines to \~/.bashrc puppet can manage the .bashrc-puppet and local mods can go into .bashrc-local
and the same for the bash_profile
https://redd.it/1p4e3yp
@r_bash
Hi
I'm looking at puppet and setting up standard alias and other things
I don't really want to take over \~/.bashrc or \~/.bash\profile
I was thinking maybe the way to do this was to add at the bottom
. (or source) \~/.bashrc-puppet
and
. (or source) \~/.bashrc-local
so that what files or other things can add / remove lines to \~/.bashrc puppet can manage the .bashrc-puppet and local mods can go into .bashrc-local
and the same for the bash_profile
https://redd.it/1p4e3yp
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Crypto backup tool
It uses zip and gnupg.
**Features**:
* double encrypt: by zip and by gnupg
* generate hash'es from given password with 1000 iterations, it's prevent easy brute force
* once setup: just use symlinks in backup directory
* ready for cron: just use env variable
* simple for code review and modify
[https://github.com/LazyMiB/Crypto-Backup-Tool](https://github.com/LazyMiB/Crypto-Backup-Tool)
https://redd.it/1p4fjhj
@r_bash
It uses zip and gnupg.
**Features**:
* double encrypt: by zip and by gnupg
* generate hash'es from given password with 1000 iterations, it's prevent easy brute force
* once setup: just use symlinks in backup directory
* ready for cron: just use env variable
* simple for code review and modify
[https://github.com/LazyMiB/Crypto-Backup-Tool](https://github.com/LazyMiB/Crypto-Backup-Tool)
https://redd.it/1p4fjhj
@r_bash
GitHub
GitHub - LazyMiB/Crypto-Backup-Tool: Secure and simple backup tool for GNU/Linux.
Secure and simple backup tool for GNU/Linux. Contribute to LazyMiB/Crypto-Backup-Tool development by creating an account on GitHub.
Beginner-friendly Bash project: Real-time CPU Usage Monitor Script (with alerts + logs)
Sharing a small Bash automation project I built for practice. This noscript monitors CPU usage in real-time using
Step-by-step explanation: https://youtu.be/nVU1JIWGnmI
Complete source code at https://github.com/Abhilashchauhan1994/bash\_noscripts/blob/main/cpu\_usage.sh
https://redd.it/1p4nobz
@r_bash
Sharing a small Bash automation project I built for practice. This noscript monitors CPU usage in real-time using
top \+ awk, sends an alert when the CPU crosses a threshold, and logs usage automatically. Step-by-step explanation: https://youtu.be/nVU1JIWGnmI
Complete source code at https://github.com/Abhilashchauhan1994/bash\_noscripts/blob/main/cpu\_usage.sh
https://redd.it/1p4nobz
@r_bash
YouTube
YOU WON'T BELIEVE How Easy Monitoring CPU Usage Is with Bash
In this step-by-step guide, you’ll learn how to create a CPU Usage Monitor Script using Bash noscripting — one of the most powerful tools for Linux automation.
Whether you’re just starting out or looking to enhance your DevOps and Linux skills, this Bash Scripting…
Whether you’re just starting out or looking to enhance your DevOps and Linux skills, this Bash Scripting…
GitHub - DeclanEaton04/OVN-Flow-1.0.0-Bash-Based-OpenVPN-Client-with-Multi-Config-Support: Bash CLI Interface | Lightweight OpenVPN Client with Dual-Layer Connection Verification, Multi-Configuration & Profile Support.
https://github.com/DeclanEaton04/OVN-Flow-1.0.0-Bash-Based-OpenVPN-Client-with-Multi-Config-Support
https://redd.it/1p5f4we
@r_bash
https://github.com/DeclanEaton04/OVN-Flow-1.0.0-Bash-Based-OpenVPN-Client-with-Multi-Config-Support
https://redd.it/1p5f4we
@r_bash
GitHub
GitHub - DeclanEaton04/OVN-Flow-1.0.0-Bash-Based-OpenVPN-Client-with-Multi-Config-Support: Bash CLI Interface | Lightweight OpenVPN…
Bash CLI Interface | Lightweight OpenVPN Client with Dual-Layer Connection Verification, Multi-Configuration & Profile Support. - GitHub - DeclanEaton04/OVN-Flow-1.0.0-Bash-Based-OpenVPN-C...
OVN-Flow | Bash-Based OpenVPN Client
https://github.com/DeclanEaton04/OVN-Flow-1.0-VPN-Client
https://redd.it/1p5lvhz
@r_bash
https://github.com/DeclanEaton04/OVN-Flow-1.0-VPN-Client
https://redd.it/1p5lvhz
@r_bash
GitHub
GitHub - DeclanEaton04/OVN-Flow-1.0-VPN-Client: Bash CLI Interface | Lightweight OpenVPN Client with Dual-Layer Connection Verification…
Bash CLI Interface | Lightweight OpenVPN Client with Dual-Layer Connection Verification, Multi-Configuration & Profile Support. - GitHub - DeclanEaton04/OVN-Flow-1.0-VPN-Client: Bash CLI I...
I've collected all my useful bash noscripts and command aliases into one CLI, but I want more!
https://github.com/Dark-Alex-17/dtools
https://redd.it/1p5wd31
@r_bash
https://github.com/Dark-Alex-17/dtools
https://redd.it/1p5wd31
@r_bash
GitHub
GitHub - Dark-Alex-17/dtools: All-in-one CLI for your command line tasks: cloud management (AWS/GCP), databases, AI tools, plotting…
All-in-one CLI for your command line tasks: cloud management (AWS/GCP), databases, AI tools, plotting, system maintenance, and more. - Dark-Alex-17/dtools
Fish like ghost completion for bash
Hi Guys,
I tried to implement fish like autocompletion suggestion for bash but I overrides the current prompt. I am trying to make this better. If you have any suggestions please let me know.
https://github.com/h-jangra/Ghost.sh
https://preview.redd.it/zjcryf5ghk3g1.png?width=1053&format=png&auto=webp&s=fbe74f55ffcbd91864ae07c4f14fdefb5a3150e3
https://redd.it/1p733ip
@r_bash
Hi Guys,
I tried to implement fish like autocompletion suggestion for bash but I overrides the current prompt. I am trying to make this better. If you have any suggestions please let me know.
https://github.com/h-jangra/Ghost.sh
https://preview.redd.it/zjcryf5ghk3g1.png?width=1053&format=png&auto=webp&s=fbe74f55ffcbd91864ae07c4f14fdefb5a3150e3
https://redd.it/1p733ip
@r_bash
GitHub
GitHub - h-jangra/Ghost.sh: Ghost text suggestions in bash
Ghost text suggestions in bash. Contribute to h-jangra/Ghost.sh development by creating an account on GitHub.