BASH | Bash Cookbook |

Vikid's Bash Cookbook

Some Simple Stuff

bash --version

ls -adFlLQrRS1

pwd -L, pwd -P

type which, type -a which

apropos zip => man -k, locate which

find

stat, file -b

chsh -s /bin/bash

passwd -el

sudo cat /etc/shells

Common Shell Variables

$USER
$-             list all current option flags

Download a website

wget -r -np -k http://somesite.com
Options:

Quoting

echo value is $3?!
echo "value is $3?!"
echo 'value is $3?!'
!" is history substitution

Sources and Links

Builtin Commands

ls () {
    builtin ls "@"
    echo "using defined ls"
}

Interactive

#!/usr/bin/env bash

case "$-" in
   *i*)
      echo "interative"
   *)
      echo "not interactive"
esac

http:///wiki/?vikidsbashcookbook

04apr23   admin