SaveSnippets
Community
Pricing
Sign In
Get Started
Community
Public Snippets
3
Code shared by the SaveSnippets community — browse, copy, and get inspired.
All Languages
Bash
Go
HTML
Java
JavaScript
Kotlin
PHP
Python
Rust
SQL
TypeScript
#prompt
Clear
Tags
#php
#kotlin
#bash
#go
#sql
#rust
#typescript
#html
#java
#python
#files
#utils
#strings
#http
#concurrency
#async
#json
#arrays
#security
#types
#crypto
#database
#dates
#format
Bash
Confirm Prompt (y/n)
A reusable yes/no prompt with a configurable default and a single-keystroke read. Returns 0 for yes, non-zero for no.
#bash
#ui
#prompt
#confirm
Bash
Pretty-Print Last Exit Code
A tiny prompt-trick that shows the previous command's exit code in red when it failed. Stops you from missing silent errors in long terminal sessions.
#bash
#ui
#exit-code
#prompt
Bash
Show Current Branch in Prompt
Append the git branch to your bash prompt. Survives non-git dirs gracefully (just shows nothing). Drop into ~/.bashrc.
#bash
#git
#prompt
#ps1