Portable shell utility library — source it and use the functions.
source shellkit.sh
# or
curl -fsSL https://raw.githubusercontent.com/abirkhan3323-source/shellkit/main/shellkit.sh | source /dev/stdin| Function | Description |
|---|---|
check "msg" cmd |
Assert a condition with ✓/✗ output |
ensure brew |
Install a tool if not present |
spinner "msg" cmd |
Run a command with animated spinner |
backup /path |
Create timestamped backup |
confirm "go?" |
Ask y/n prompt |
bench "label" cmd |
Time a command in milliseconds |
random_string 32 |
Generate random alphanumeric string |
jsonval '.key' file.json |
Extract JSON value without jq |
dedup file.txt |
Remove duplicate lines, preserving order |
coln 3 |
Extract column N from each line |
sum |
Sum a column of numbers |
running "app" cmd |
Keep a process running, restart on exit |
is_port_free 3000 |
Check if a port is available |
is_command git |
Check if a command exists |
source shellkit.sh
# Pre-deploy checklist
check "node installed" is_command node
check "port 3000 free" is_port_free 3000
# Timed backup
spinner "Backing up database..." pg_dump mydb > backup.sql
backup backup.sql
# Deploy with keepalive
running "web server" python -m http.server 8080