Skip to content

Instantly share code, notes, and snippets.

View FST777's full-sized avatar

Frans-Jan van Steenbeek FST777

View GitHub Profile

Keybase proof

I hereby claim:

  • I am fst777 on github.
  • I am fst777 (https://keybase.io/fst777) on keybase.
  • I have a public key whose fingerprint is AFEF 25CA 64D3 88F0 048B A6AA 275C CDA8 AB6E 5B6C

To claim this, I am signing this object:

@FST777
FST777 / please.sh
Created August 27, 2019 10:29
Function to be nice to your shell. Bash and Zsh compatible.
please() {
if [[ -z "$@" || "${1}" = "?" ]]; then
if [[ -n "${ZSH_VERSION}" ]]; then
sudo $(fc -l -1 | cut -c 8-)
elif [[ -n "${BASH_VERSION}" ]]; then
sudo $(fc -l -2 | cut -f 2- | head -n 1)
else
echo "I don't know what you want."
fi
else