git from - selectively pull files into your CWD from any Git repo, treating repos as modules
I created a Bash tool that lets you treat any Git repository as a package/module that you can selectively install from.
Basic usage:
That pulls only the "skill-creator" skill from the repo into ".claude" in your local directory. Nothing else comes along.
You can combine
The
It's a slightly fancier
Git From: Git Repositories as a Module System – Al Newkirk
https://alnewkirk.com/projects/git-from
alnewkirk/git-from: Git Repositories as a Module System
https://github.com/alnewkirk/git-from
https://redd.it/1shm586
@r_bash
I created a Bash tool that lets you treat any Git repository as a package/module that you can selectively install from.
Basic usage:
git from https://github.com/anthropics/skills --include skills/skill-creator --target .claude
That pulls only the "skill-creator" skill from the repo into ".claude" in your local directory. Nothing else comes along.
You can combine
--include and --exclude to carve out exactly the slice you want. There's an optional .gitfrom file that lives in the source repo defining default distribution rules (which files to include/exclude, what to run after copying). Think of it as the publisher saying "here's the intended slice."The
--perform flag runs a command after the files land. Useful for symlinking, setting permissions, running a setup script.It's a slightly fancier
curl | bash. With the same security model :)Git From: Git Repositories as a Module System – Al Newkirk
https://alnewkirk.com/projects/git-from
alnewkirk/git-from: Git Repositories as a Module System
https://github.com/alnewkirk/git-from
https://redd.it/1shm586
@r_bash
Alnewkirk
Git From: Git Repositories as a Module System – Al Newkirk
Every Git repository is already a package. The only thing missing is an installer that respects "I only want a slice of this."
Something better than alias? or is this peak.
These all all the alias i have so far...
I work most in backend and infra side, to make my life easier i decided to do this, is there something more better i can do here, so is this peak?
https://redd.it/1siekh2
@r_bash
These all all the alias i have so far...
I work most in backend and infra side, to make my life easier i decided to do this, is there something more better i can do here, so is this peak?
https://redd.it/1siekh2
@r_bash
Capturing exit codes reliably in an interactive shell session
I’m working on capturing terminal sessions step by step (commands, outputs, etc.), and one tricky part has been reliably getting exit codes for each command.
Right now I’m using a small marker injected via PROMPT_COMMAND / precmd (bash/zsh) that prints something like `__TT_RC__:<code>` before the next prompt, and then parsing it out from the stream.
It works, but feels a bit hacky.
Curious if there are better or more robust ways to capture exit codes in an interactive session without breaking normal shell behavior?
https://redd.it/1sikx3i
@r_bash
I’m working on capturing terminal sessions step by step (commands, outputs, etc.), and one tricky part has been reliably getting exit codes for each command.
Right now I’m using a small marker injected via PROMPT_COMMAND / precmd (bash/zsh) that prints something like `__TT_RC__:<code>` before the next prompt, and then parsing it out from the stream.
It works, but feels a bit hacky.
Curious if there are better or more robust ways to capture exit codes in an interactive session without breaking normal shell behavior?
https://redd.it/1sikx3i
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
I made my first bash script! It opens vim with a file name and a shebang already set!
I've been wanting to get further into bash scripting as I've started using the terminal more and more, so I did some research (shout out to the bash manual (not the one in the epstein files) and YSAP) and took what I know from messing around in python, and made this simple little script:
\#!/usr/bin/env bash
read -p "what is the name of the script? " name
while true; do
if [[ $name == *" "* \]\]; then
echo "please, no spaces."
sleep 3
read -p "what is the name of the script? " name
continue
elif [[ -n "$name" \]\]; then
touch $name
echo '#!/usr/bin/env bash' >> $name
vim $name
else
echo "aight, suit yerself. here's vim with nothing, ig."
sleep 5
vim
fi
break
done
https://redd.it/1sj4fcx
@r_bash
I've been wanting to get further into bash scripting as I've started using the terminal more and more, so I did some research (shout out to the bash manual (not the one in the epstein files) and YSAP) and took what I know from messing around in python, and made this simple little script:
\#!/usr/bin/env bash
read -p "what is the name of the script? " name
while true; do
if [[ $name == *" "* \]\]; then
echo "please, no spaces."
sleep 3
read -p "what is the name of the script? " name
continue
elif [[ -n "$name" \]\]; then
touch $name
echo '#!/usr/bin/env bash' >> $name
vim $name
else
echo "aight, suit yerself. here's vim with nothing, ig."
sleep 5
vim
fi
break
done
https://redd.it/1sj4fcx
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Why doesn’t this Bash script exit even with set -e?
I came across an interesting Bash behavior while experimenting with error handling:
set -e
echo "Starting deployment..."
build_project && deploy_project
echo "Deployment complete"
At first glance, expected that if `build_project` fails, the script should exit immediately because of `set -e`.
But the actual output is:
Deployment complete
From what I understand, `set -e` doesn’t trigger an exit when a failing command is part of a **conditional context** like `&&`, `||`, `if`, etc.
So in this case:
* `false` fails
* But since it’s inside an `&&` chain, Bash treats it as expected control flow
* And continues execution
I’ve been digging deeper into these kinds of edge cases lately (especially from an interview perspective).
If anyone’s interested, I’ve written a more detailed breakdown with examples — happy to share
https://redd.it/1sjdkv5
@r_bash
I came across an interesting Bash behavior while experimenting with error handling:
set -e
echo "Starting deployment..."
build_project && deploy_project
echo "Deployment complete"
At first glance, expected that if `build_project` fails, the script should exit immediately because of `set -e`.
But the actual output is:
Deployment complete
From what I understand, `set -e` doesn’t trigger an exit when a failing command is part of a **conditional context** like `&&`, `||`, `if`, etc.
So in this case:
* `false` fails
* But since it’s inside an `&&` chain, Bash treats it as expected control flow
* And continues execution
I’ve been digging deeper into these kinds of edge cases lately (especially from an interview perspective).
If anyone’s interested, I’ve written a more detailed breakdown with examples — happy to share
https://redd.it/1sjdkv5
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
How to print input if command returns nothing?
I have a command which is supposed to find audio files with no cover image.
What I currently have is
find /srv/media/Music/ -type f -regex '.*\.\(mp3\|flac\|m4a\|opus\)' \
-exec bash -c ' ffprobe -hide_banner -loglevel error \
-select_streams v -show_entries stream=codec_type -of csv=p=0 "$0" \
' {} \;
which gives an output of 'video' if a cover image is attached and no output if no cover image is attached.
How can I expand this so that I get all files with no cover images listed?
I tried to switch STDERR and STDOUT and use a pipe with `$?` to catch this, but couldn't make it work. I always get all the files, not just the ones with no cover image. Command used was `... "$0" 1>&2 | if [[ $? = 0 ]]; then echo "$0"; fi ' {} \;`.
https://redd.it/1sjefve
@r_bash
I have a command which is supposed to find audio files with no cover image.
What I currently have is
find /srv/media/Music/ -type f -regex '.*\.\(mp3\|flac\|m4a\|opus\)' \
-exec bash -c ' ffprobe -hide_banner -loglevel error \
-select_streams v -show_entries stream=codec_type -of csv=p=0 "$0" \
' {} \;
which gives an output of 'video' if a cover image is attached and no output if no cover image is attached.
How can I expand this so that I get all files with no cover images listed?
I tried to switch STDERR and STDOUT and use a pipe with `$?` to catch this, but couldn't make it work. I always get all the files, not just the ones with no cover image. Command used was `... "$0" 1>&2 | if [[ $? = 0 ]]; then echo "$0"; fi ' {} \;`.
https://redd.it/1sjefve
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
I wrote a stupid simple progress bar in pure BASH (source in comments)
https://redd.it/1sjg2di
@r_bash
https://redd.it/1sjg2di
@r_bash
Cannot use jq to separate in every iteration
Hello!
I need help to put delimiter between pairs of values, like this:
or like this:
What i have:
What i am doing now to get what i want:
What is output of this command:
Without "join":
Seems like jq thinks that input in one array.
https://redd.it/1sjrr58
@r_bash
Hello!
I need help to put delimiter between pairs of values, like this:
1,a;2,bor like this:
1,a 2,bWhat i have:
[ { "name": "1", "argument": "a" }, { "name": "2", "argument": "b" } ]What i am doing now to get what i want:
cat file.txt | jq -r -c 'map(.name, .argument) | join (";")'What is output of this command:
1;a;2;bWithout "join":
cat file.txt | jq -r -c 'map(.name, .argument)["1","a","2","b"]Seems like jq thinks that input in one array.
https://redd.it/1sjrr58
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Quick help comparing files in two directories?
Long story short, know for a fact that I have duplicates between two directories, but we're talking hundreds of files here and I know at least a few files are in one directory but not the other.
I'd ideally like to have something quickly compare file name & size between the two directories, then spit out the files that are named the same but sized differently, as well as files which are in one directory but not the other.
https://redd.it/1skc8wu
@r_bash
Long story short, know for a fact that I have duplicates between two directories, but we're talking hundreds of files here and I know at least a few files are in one directory but not the other.
I'd ideally like to have something quickly compare file name & size between the two directories, then spit out the files that are named the same but sized differently, as well as files which are in one directory but not the other.
https://redd.it/1skc8wu
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Seeking Practice for Shell Scripting (Specifically POSIX sh / Bash)
Hello everyone !
I’ve been working through some great tutorials (like YouTube : yousuckatprogramming or LearnLinuxTv), but
I’ve hit a wall where I feel like I’m just "passively" absorbing information. I’m currently preparing for a technical school entrance exam so I’m looking for practice cases or problems. (ideally bin/sh or POSIX-compliant bash)
Specifically:
\- Practice Platforms: Are there any sites like DataLemur that have a strong focus on shell scripting ?
\- Real-World Scenarios: For those of you who aren't currently in a DevOps/SysAdmin role, how do you find "mini-projects" to build? I want to move past "Hello World" and into actual file manipulation, parsing, and automation.
My goal is to stop watching and start doing. If you have any "scripts you wish you had when you started" or repos with challenges, please drop them below!
Thanks in advance!
Note: I'm currently on Linux Mint Cinnamon (started using like 1 week ago)...always been a Windows user before.
https://redd.it/1skyhb1
@r_bash
Hello everyone !
I’ve been working through some great tutorials (like YouTube : yousuckatprogramming or LearnLinuxTv), but
I’ve hit a wall where I feel like I’m just "passively" absorbing information. I’m currently preparing for a technical school entrance exam so I’m looking for practice cases or problems. (ideally bin/sh or POSIX-compliant bash)
Specifically:
\- Practice Platforms: Are there any sites like DataLemur that have a strong focus on shell scripting ?
\- Real-World Scenarios: For those of you who aren't currently in a DevOps/SysAdmin role, how do you find "mini-projects" to build? I want to move past "Hello World" and into actual file manipulation, parsing, and automation.
My goal is to stop watching and start doing. If you have any "scripts you wish you had when you started" or repos with challenges, please drop them below!
Thanks in advance!
Note: I'm currently on Linux Mint Cinnamon (started using like 1 week ago)...always been a Windows user before.
https://redd.it/1skyhb1
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
IP Identification Open Source Intel script
This is just a quick script I created because I am constantly having to lookup the information for IP addresses and this one will give you the SOA record for the server the IP is hosted on the whois information for the domain that the IP points as well as the nameservers and a few other relative bits of information. I called it IPID but I feel like there is something similar already out there with the same name so I am not taking credit for the name.
as with any bash script you will need to add it to PATH if you want to use it as a local shell command.
hope someone finds it useful.
https://preview.redd.it/b81ewoinv6vg1.png?width=1033&format=png&auto=webp&s=fce2610c2248e6d61d630e4280714b4b721bfc2a
#!/bin/bash
# Define colors for a cleaner, readable output
GREEN='\0330;32m'
CYAN='\033[0;36m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Check if an argument is provided; if not, display the usage template
if [ -z "$1" ; then
echo -e "${RED}Error: No IPv4 address supplied.${NC}"
echo -e "Usage: ${GREEN}ipid <ipv4address>${NC}"
echo -e "Example: ${GREEN}ipid 8.8.8.8${NC}"
exit 1
fi
TARGETIP=$1
# Basic IPv4 validation
if ! [ $TARGET_IP =~ ^[0-9{1,3}\.0-9{1,3}\.0-9{1,3}\.0-9{1,3}$ ]]; then
echo -e "${RED}Error: '$TARGETIP' does not look like a valid IPv4 address.${NC}"
exit 1
fi
echo -e "${YELLOW}Gathering intelligence for IP: ${TARGETIP}...${NC}\n"
# 1. Reverse DNS / Hostname
echo -e "${CYAN}+ Hostname & Reverse DNS Lookup${NC}"
if command -v host &> /dev/null; then
host "$TARGETIP"
else
echo -e "${RED}[!] 'host' command not found. Skipping reverse DNS.${NC}"
fi
echo ""
# 2. Server Location, ASN, and ISP Details (via ipinfo.io)
echo -e "${CYAN}[+] Server Location & ISP Details${NC}"
if command -v curl &> /dev/null; then
# Fetching JSON data and displaying it cleanly
curl -s "https://ipinfo.io/${TARGETIP}/json" | grep -v 'readme'
else
echo -e "${RED}! 'curl' command not found. Skipping location details.${NC}"
fi
echo ""
# 3. WHOIS Organization & Network Info
echo -e "${CYAN}+ WHOIS Organization & Domain Info (Summary)${NC}"
if command -v whois &> /dev/null; then
# Grepping the most relevant fields so the terminal isn't flooded with legalese
whois "$TARGETIP" | grep -iE '^(OrgName|Organization|NetName|NetRange|CIDR|Country|StateProv|City|RegDate|Updated|ASName)' | sort -u | head -n 15
# If the summary is empty, the whois server might use different formatting
if [ ${PIPESTATUS[0]} -ne 0 ]; then
echo "Could not parse standard WHOIS summary. Try running 'whois $TARGETIP' manually."
fi
else
echo -e "${RED}! 'whois' command not found. Install 'whois' to see domain registration info.${NC}"
fi
echo ""
echo -e "${YELLOW}Scan complete.${NC}"
https://redd.it/1slf4ua
@r_bash
This is just a quick script I created because I am constantly having to lookup the information for IP addresses and this one will give you the SOA record for the server the IP is hosted on the whois information for the domain that the IP points as well as the nameservers and a few other relative bits of information. I called it IPID but I feel like there is something similar already out there with the same name so I am not taking credit for the name.
as with any bash script you will need to add it to PATH if you want to use it as a local shell command.
hope someone finds it useful.
https://preview.redd.it/b81ewoinv6vg1.png?width=1033&format=png&auto=webp&s=fce2610c2248e6d61d630e4280714b4b721bfc2a
#!/bin/bash
# Define colors for a cleaner, readable output
GREEN='\0330;32m'
CYAN='\033[0;36m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Check if an argument is provided; if not, display the usage template
if [ -z "$1" ; then
echo -e "${RED}Error: No IPv4 address supplied.${NC}"
echo -e "Usage: ${GREEN}ipid <ipv4address>${NC}"
echo -e "Example: ${GREEN}ipid 8.8.8.8${NC}"
exit 1
fi
TARGETIP=$1
# Basic IPv4 validation
if ! [ $TARGET_IP =~ ^[0-9{1,3}\.0-9{1,3}\.0-9{1,3}\.0-9{1,3}$ ]]; then
echo -e "${RED}Error: '$TARGETIP' does not look like a valid IPv4 address.${NC}"
exit 1
fi
echo -e "${YELLOW}Gathering intelligence for IP: ${TARGETIP}...${NC}\n"
# 1. Reverse DNS / Hostname
echo -e "${CYAN}+ Hostname & Reverse DNS Lookup${NC}"
if command -v host &> /dev/null; then
host "$TARGETIP"
else
echo -e "${RED}[!] 'host' command not found. Skipping reverse DNS.${NC}"
fi
echo ""
# 2. Server Location, ASN, and ISP Details (via ipinfo.io)
echo -e "${CYAN}[+] Server Location & ISP Details${NC}"
if command -v curl &> /dev/null; then
# Fetching JSON data and displaying it cleanly
curl -s "https://ipinfo.io/${TARGETIP}/json" | grep -v 'readme'
else
echo -e "${RED}! 'curl' command not found. Skipping location details.${NC}"
fi
echo ""
# 3. WHOIS Organization & Network Info
echo -e "${CYAN}+ WHOIS Organization & Domain Info (Summary)${NC}"
if command -v whois &> /dev/null; then
# Grepping the most relevant fields so the terminal isn't flooded with legalese
whois "$TARGETIP" | grep -iE '^(OrgName|Organization|NetName|NetRange|CIDR|Country|StateProv|City|RegDate|Updated|ASName)' | sort -u | head -n 15
# If the summary is empty, the whois server might use different formatting
if [ ${PIPESTATUS[0]} -ne 0 ]; then
echo "Could not parse standard WHOIS summary. Try running 'whois $TARGETIP' manually."
fi
else
echo -e "${RED}! 'whois' command not found. Install 'whois' to see domain registration info.${NC}"
fi
echo ""
echo -e "${YELLOW}Scan complete.${NC}"
https://redd.it/1slf4ua
@r_bash
[Release] I built a bulletproof Screen Time / Parental Control script for Linux Mint (Cinnamon) that fixes the idle-tracking bug.
/r/linuxmint/comments/1slpro5/release_i_built_a_bulletproof_screen_time/
https://redd.it/1slpsez
@r_bash
/r/linuxmint/comments/1slpro5/release_i_built_a_bulletproof_screen_time/
https://redd.it/1slpsez
@r_bash
Reddit
From the bash community on Reddit: [Release] I built a bulletproof Screen Time / Parental Control script for Linux Mint (Cinnamon)…
Posted by Fast_Association4804 - 1 vote and 0 comments
Bash script to determine if I have a routable IP address
At my home I have a dynamic IP address which changes at least daily. I have an arrangement with my ISP to always have a routable IP. However, sometimes they mess up and give me a non-routable IP. I would like to be able to detect this from within a shell script so that the shell script can notify me and take other action.
Here's what I'm doing now: I have a remote Raspberry Pi set up with a reverse SSH tunnel to my iMac at home. I can easily detect whether that tunnel is up or not. If it is not up, then it is likely, but not 100% sure, that the cause is a non-routable IP at home. The router at home is a Deco X20.
Is there a better way to determine whether or not my home IP address is routable or not?
https://redd.it/1slznt2
@r_bash
At my home I have a dynamic IP address which changes at least daily. I have an arrangement with my ISP to always have a routable IP. However, sometimes they mess up and give me a non-routable IP. I would like to be able to detect this from within a shell script so that the shell script can notify me and take other action.
Here's what I'm doing now: I have a remote Raspberry Pi set up with a reverse SSH tunnel to my iMac at home. I can easily detect whether that tunnel is up or not. If it is not up, then it is likely, but not 100% sure, that the cause is a non-routable IP at home. The router at home is a Deco X20.
Is there a better way to determine whether or not my home IP address is routable or not?
https://redd.it/1slznt2
@r_bash
Reddit
From the bash community on Reddit
Explore this post and more from the bash community
Bash scripts to set up your Yubikey to work with GitHub (OpenGPG, SSH)
https://github.com/andrinoff/yubikey-github
A pretty straightforward guide, as well as 2 automatic scripts, that you can run to set it up for you (could be buggy)
Look forward to contributions!
https://redd.it/1snevss
@r_bash
https://github.com/andrinoff/yubikey-github
A pretty straightforward guide, as well as 2 automatic scripts, that you can run to set it up for you (could be buggy)
Look forward to contributions!
https://redd.it/1snevss
@r_bash
GitHub
GitHub - andrinoff/yubikey-github: Guide for Yubikey usage with GitHub (SSH & OpenGPG)
Guide for Yubikey usage with GitHub (SSH & OpenGPG) - andrinoff/yubikey-github
Persistent Sidebar Pane within TMUX that tracks your AI Agent Sessions
https://redd.it/1snrhxc
@r_bash
https://redd.it/1snrhxc
@r_bash
slate — one command to theme your terminal + prompt + CLI tools in sync (Rust, macOS/Linux)
Built this over the last few months, tagged 0.1.1. One command sets up a coordinated palette across your shell prompt (via Starship), bat, delta, eza, lazygit, fastfetch, tmux, and your terminal emulator (Ghostty/Kitty/Alacritty).
For bash specifically, slate adds a single marker-block to your \~/.bashrc(or \~/.bash_profile on macOS) that sources a managed env file. `slate clean` removes that block cleanly — no orphaned exports, no leftover state.
`cargo install slate-cli` or `brew install MoonMao42/homebrew-tap/slate-cli`
Repo: https://github.com/MoonMao42/slate
Happy to hear feedback on the shell integration — especially the marker-block approach vs alternatives like a standalone rc snippet file.
https://redd.it/1so42dt
@r_bash
Built this over the last few months, tagged 0.1.1. One command sets up a coordinated palette across your shell prompt (via Starship), bat, delta, eza, lazygit, fastfetch, tmux, and your terminal emulator (Ghostty/Kitty/Alacritty).
For bash specifically, slate adds a single marker-block to your \~/.bashrc(or \~/.bash_profile on macOS) that sources a managed env file. `slate clean` removes that block cleanly — no orphaned exports, no leftover state.
`cargo install slate-cli` or `brew install MoonMao42/homebrew-tap/slate-cli`
Repo: https://github.com/MoonMao42/slate
Happy to hear feedback on the shell integration — especially the marker-block approach vs alternatives like a standalone rc snippet file.
https://redd.it/1so42dt
@r_bash
GitHub
GitHub - MoonMao42/slate: One-command terminal setup for macOS and Linux — themes, prompts, fonts, and tools all in sync.
One-command terminal setup for macOS and Linux — themes, prompts, fonts, and tools all in sync. - MoonMao42/slate