Skip to main content

BASH ULTIMATE MAN PAGE

------------------------------------------------------------------------------------------------------------------------------------------------====================================================================================

  #!/bin/bash

Beginning a bash script

====================================================================================

echo #!/bin/bash'enter domain name to test'
read domain

Set user input as a variable

====================================================================================

ECHO

echo -e

allow interpretation of backslash-escaped character:

      \a    alert (bell)
      \b    backspace
      \c    suppress further output
      \e    escape character
      \E    escape character
      \f    form feed
      \n    new line
      \r    carriage return
      \t    horizontal tab
      \v    vertical tab
      \\    backslash
      \0nnn    the character whose ASCII code is NNN (octal).  NNN can be
            0 to 3 octal digits
      \xHH    the eight-bit character whose value is HH (hexadecimal).  HH
            can be one or two hex digits
      \uHHHH    the Unicode character whose value is the hexadecimal value HHHH.
            HHHH can be one to four hex digits.
      \UHHHHHHHH the Unicode character whose value is the hexadecimal value
            HHHHHHHH. HHHHHHHH can be one to eight hex digits.

echo "${x%Y}"

Remove a character (Y) from a string

====================================================================================

SORT

sort -k1 

Sort a file or output by a specific column, ie sort -k1 would sort by the first column

------------------------------------------------------------------------------------------------------------------------------------------------

Set user input as a variable

echosort 'enter domain name to test'
read domain-n

Numeric sort (default sort order is ascending).

-----------------------------------------------------------------------------------------------------------------------------------------------

sort -r

Reverse the output of the sort.

SORT====================================================================================

AWK

awk '{print $1,$2}'

sort -k1 (sort a file or output by a specific column, ie sort -k1 would sort byPrint the first column)

and

sortsecond -r (reverse the results)

sort -n (Numeric sort)column

------------------------------------------------------------------------------------------------------------------------------------------------

AWK

awk '{print $1,$2}' (print the first and second column)