Why does local out=$(cmd) hide the command's exit status?
In a Bash function, I noticed that local out=$(false) reports success, but declaring out first and then assigning out=$(false) reports failure. Why are they different, and what's a…
In a Bash function, I noticed that local out=$(false) reports success, but declaring out first and then assigning out=$(false) reports failure. Why are they different, and what's a…
I'm learning PowerShell on Windows and find it more intuitive than Bash. Would it be practical for everyday Linux administration and automation? What limitations should I expect, and…
I put together a free roadmap that goes from shell basics and permissions through boot, services, networking, storage and security. Each stage has a small project to practice…
A cleanup function runs a failing command and then prints a success message. With set -e enabled, calling the function as an if condition still reaches the success…
My script finds directories containing a .config directory, changes into each parent directory, and runs an update command. There are a few thousand of them, so sequential execution…
I found grep "Nmap scan report\|tcp open" in a script that filters nmap output. There is no pipe character in the output, so what is \| doing? Is…
I'm learning Bash and found an older guide to defensive scripting. Are there more current resources or practices worth following?Also, if a script needs a lot of checks…
I have directories named like [2020] Title and (2021) Title. How can I rename them to 2020 - Title and 2021 - Title in Bash?
I can run steamosctl get-default-desktop-session in a terminal, but the same command in a Bash script reports no such file or directory. The script has a Bash shebang…
My script loops from zero to the CPU count, prints the counter, touches a file, and increments the counter with let. When I run it with sh, most…
I'm applying the Argo CD installation manifest from a shell script and want to wait before running commands against it. The manifest includes service accounts and other resources…
Iโm on CachyOS and would like fish as my interactive terminal shell, while writing scripts for zsh. Do those need to be the same shell, and how should…
Iโm trying to find MP3 files in nested directories and process each one. A loop using command substitution splits paths at spaces, so a file like โ./bass drum/track.mp3โ…
A loop using the same find command reportedly takes about a second with dash and around 15 seconds with Bash. What could explain a gap that large, and…
Hi! This is my first time using Bash, and I'm trying to run a Python script on every file in /data/folder. I want each result to be written…
I need to extract the application version from pyproject.toml using this awk command: awk -F'"' '/^version[[:space:]]*=/ {print $2; exit}' pyproject.toml. What is the correct way to assign that…
Hi! I'm new to Bash and I'm trying to loop through every file in /data/folder, pass each one to munge_sumstats.py, and write the processed result to another folder.…
I'm new to Linux and Bash and wrote this script to build and publish my Bevy game to GitHub Pages. It detects Ubuntu, Arch, or CachyOS, updates the…
I wrote a Bash script to create a full snapshot of several source directories under a timestamped destination. For now, the source and backup paths can be hard-coded.…
I'm writing a Bash script to create a full snapshot of several source directories in a timestamped backup directory. For now, I'm fine with hard-coded paths. The script…