Snippets Collections
#!/bin/bash
# Bash Menu Script Example

PS3='Please enter your choice: '
options=("Option 1" "Option 2" "Option 3" "Quit")
select opt in "${options[@]}"
do
    case $opt in
        "Option 1")
            echo "you chose choice 1"
            ;;
        "Option 2")
            echo "you chose choice 2"
            ;;
        "Option 3")
            echo "you chose choice $REPLY which is $opt"
            ;;
        "Quit")
            break
            ;;
        *) echo "invalid option $REPLY";;
    esac
done
@echo off
powershell -Command "Start-Process cmd -Verb RunAs -ArgumentList '/c cd /d %CD% && %*'"
@echo on
printf "\n>name\naagg" >> temp.fa
git branch | grep -v "master" | xargs git branch -D
Explanation:

🛒 Get all branches (except for the master) via git branch | grep -v "master" command
👇 Select every branch with xargs command
💦 Delete branch with xargs git branch -D
# For brews
$ brew info --json $(brew list) | jq -r '.[] | select(.caveats != null) | "\n\nName: \(.name)\nCaveats: \(.caveats)"'

# For casks
$ brew cask --json=v1 info $(brew cask list) | jq -r '.[] | select(.caveats != null) | "\n\nName: \(.name)\nCaveats: \(.caveats)"'
#!/bin/bash

PBTEMP=$(mktemp -t pbtemp)
pbpaste > $PBTEMP
nano -t $PBTEMP
source $PBTEMP
rm $PBTEMP
#!/bin/bash

read -p "Are you sure you wish to execute \`$(pbpaste)\`? (Y/n) "    
[[ $REPLY =~ ^[Yy]?$  ]] && pbpaste | bash
star

Wed Nov 17 2021 09:57:14 GMT+0000 (UTC) https://stackoverflow.com/questions/38882654/docker-entrypoint-running-bash-script-gets-permission-denied/38882798

#sh
star

Thu Nov 11 2021 02:47:56 GMT+0000 (UTC) https://stackoverflow.com/questions/835501/how-do-you-stash-an-untracked-file

#sh
star

Mon Oct 18 2021 07:57:50 GMT+0000 (UTC) https://askubuntu.com/questions/1705/how-can-i-create-a-select-menu-in-a-shell-script

#bash #sh #script #shell #shellscript
star

Tue Aug 03 2021 04:10:33 GMT+0000 (UTC) https://stackoverflow.com/questions/59895/how-can-i-get-the-source-directory-of-a-bash-script-from-within-the-script-itsel?noredirect

#sh
star

Wed Jun 02 2021 15:33:20 GMT+0000 (UTC) https://stackoverflow.com/questions/9652720/how-to-run-sudo-command-in-windows/55643173#55643173

#sh
star

Sat May 29 2021 21:03:45 GMT+0000 (UTC) https://stackoverflow.com/questions/2518127/how-to-reload-bashrc-settings-without-logging-out-and-back-in-again

#sh
star

Fri May 21 2021 20:37:55 GMT+0000 (UTC)

#sh
star

Fri Feb 12 2021 22:18:32 GMT+0000 (UTC) https://stackoverflow.com/questions/10610327/delete-all-local-git-branches

#sh
star

Wed Feb 03 2021 09:56:26 GMT+0000 (UTC) https://stackoverflow.com/questions/13333585/how-do-i-replay-the-caveats-section-from-a-homebrew-recipe/13333858

#sh
star

Fri Dec 04 2020 04:55:38 GMT+0000 (UTC) https://apple.stackexchange.com/questions/72182/is-there-a-way-to-make-pasting-into-terminal-safe?rq

#sh
star

Fri Dec 04 2020 04:55:33 GMT+0000 (UTC) https://apple.stackexchange.com/questions/72182/is-there-a-way-to-make-pasting-into-terminal-safe?rq

#sh
star

Fri Aug 14 2020 01:34:38 GMT+0000 (UTC) https://stackoverflow.com/questions/34796888/how-to-open-google-chrome-from-terminal

#sh

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension