Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shellkit

Portable shell utility library — source it and use the functions.

Install

source shellkit.sh
# or
curl -fsSL https://raw.githubusercontent.com/abirkhan3323-source/shellkit/main/shellkit.sh | source /dev/stdin

Functions

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

Examples

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

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages