Skip to content

Code shortcut for Linux

Overview

👻 She bang concept, using at the first script with shell script

#!/bin/bash

👻 Check user is root 1

Use case: Using for element

if [[ "$(whoami)" != root ]]; then
  echo "Only user root can run this script."
  exit 1
fi

Retries

Replace "command" with your command. This is assuming that "status code=FAIL" means any non-zero return code.

for i in 1 2 3 4 5; do <command> && break || sleep 15; done

Reference