A structured system for creating, managing, and executing Bash and UV Python scripts with consistent templates and easy discovery.
~/Developer/scripts/
├── bash/ # Bash-specific scripts
├── uv/ # UV Python scripts
├── utils/ # General utility scripts
├── system/ # System administration scripts
├── network/ # Network-related scripts
├── dev/ # Development workflow scripts
├── template.sh # Template for Bash scripts
├── template-uv.py # Template for UV Python scripts
├── script-index.sh # Lists all available scripts
├── new-script.sh # Creates new scripts from templates
├── zsh-config.zsh # ZSH configuration for the system
└── README.md # System documentation
Add to your ~/.zshrc
file:
source ~/Developer/scripts/zsh-config.zsh
If installed elsewhere:
-
Update the path in
.zshrc
:source /path/to/your/scripts/zsh-config.zsh
-
Update paths in zsh-config.zsh:
# Edit the file nano /path/to/your/scripts/zsh-config.zsh # Update all paths to match your location
-
Reload your configuration:
source ~/.zshrc
newscript <category> <script-name> [type]
Where:
<category>
is one of: bash, uv, utils, system, network, dev<script-name>
is the name without extension[type]
is optional:bash
(default) oruv
# New bash script in utils
newscript utils compress-images bash
# New UV Python script in dev
newscript dev git-stats uv
# New bash script (default type)
newscript system backup-config
#!/bin/bash
# Description:
# Usage:
# Author: yourusername
# Created: 2025-05-14
# Exit on error
set -e
# Script content here
main() {
echo "Hello from bash script!"
}
main "$@"
# /// script
# dependencies = [
# "loguru",
# "python-dotenv",
# ]
# ///
# Description:
# Usage:
# Author: yourusername
# Created: 2025-05-14
def main():
"""Main function."""
print("Hello from uv script!")
if __name__ == "__main__":
main()
scripts
Example output:
Available Scripts:
-----------------
backup-config.sh - Backs up system configuration files
compress-images.sh - Compresses images in current directory
git-stats.py - Generates statistics for git repositories
Bash scripts:
compress-images.sh [arguments]
UV Python scripts:
uv run git-stats [arguments]
The uv run
function:
- Adds .py extension if needed
- Runs with
uv run
to handle dependencies - Passes all arguments to the script
- Use hyphen-separated words
- Include descriptive prefixes (e.g.,
backup-
,git-
) - Be concise but clear
Include in all script headers:
- Description: Short summary of what it does
- Usage: How to use, including arguments
- Author: Your name or username
- bash/: Bash-specific functionality
- uv/: UV Python functionality
- utils/: General utility scripts
- system/: System administration
- network/: Network-related tools
- dev/: Development workflow scripts
For Node.js projects:
- Use
pnpm
instead of npm or yarn - Note that "framer-motion" is now "motion"
- Update imports:
from 'motion/react'
instead offrom 'framer-motion'
# Create directory
mkdir -p ~/Developer/scripts/new-category
# Reload shell
exec zsh
# Initialize repo
cd ~/Developer/scripts
git init
# Add gitignore
echo ".DS_Store" > .gitignore
# Initial commit
git add .
git commit -m "Initial setup"
If the system isn't working:
-
Check if zsh-config.zsh is sourced:
grep "source.*zsh-config.zsh" ~/.zshrc
-
Verify paths in zsh-config.zsh:
cat ~/Developer/scripts/zsh-config.zsh | grep "HOME/Developer/scripts"
-
Check if scripts directory is in PATH:
echo $PATH | grep -o "Developer/scripts"
If a script isn't found:
- Make it executable:
chmod +x ~/Developer/scripts/category/script-name.sh
- Check PATH:
echo $PATH | grep -o "~/Developer/scripts/category"
- Reload shell:
exec zsh
If dependencies aren't working:
- Check PEP 723 format in script
- Use
uv run
function, not direct execution - Verify UV installation:
uv --version