From f48ab51c8dfc92550b5172844025551112a3c0fd Mon Sep 17 00:00:00 2001 From: Karol Pucynski Date: Tue, 28 Apr 2020 12:29:00 +0200 Subject: [PATCH] Graceful exit on non-linux platforms. --- bashtop | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bashtop b/bashtop index 373fd39..efb58ed 100755 --- a/bashtop +++ b/bashtop @@ -173,8 +173,24 @@ else } fi +system_check_() { + local system + case "$(uname -s)" in + Linux*) system=Linux;; + Darwin*) system=MacOS;; + CYGWIN*) system=Cygwin;; + MINGW*) system=MinGw;; + *) system="Other" + esac + if [[ "$system" != "Linux" ]]; then + echo "This tool does not support $system platform." + exit 1 + fi +} init_() { #? Collect needed information and set options before startig main loop + system_check_ + local i #* Set terminal options, save and clear screen tput smcup