Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Internal functions

Version detection

Useful files to parse on Linux:

  • /etc/os-release
  • /proc/version

How to get OS name from /etc/os-release:

  • -F=: Tell awk to use = as separator.
  • $1=="ID": Filter on ID.
  • { print $2 ;}: Print value.

Strip quotes:

sed 's/"//g'
tr -d \"
tr -cd '[:alnum:]'

macOS version: currently, use of sw_vers is recommended. Alternatively, can parse this file directly instead: /System/Library/CoreServices/SystemVersion.plist

See also:

Redirecting console output

Redirect the console output to a file:

SomeCommand > SomeFile.txt

Or if you want to append data:

SomeCommand >> SomeFile.txt

If you want stderr as well use this:

SomeCommand &> SomeFile.txt

Or this to append:

SomeCommand &>> SomeFile.txt

If you want to have both stderr and output displayed on the console and in a file use this:

SomeCommand 2>&1 | tee SomeFile.txt

If you want the output only, drop the 2 above.

You can’t perform that action at this time.