5 Commits 8d186a8d7e ... 2c8c87564c

Author SHA1 Message Date
  Max Megavolt 2c8c87564c corrections 2 years ago
  Max Megavolt 8d186a8d7e correction 2 years ago
  Max Megavolt 60509bc810 correction 2 years ago
  Max Megavolt 08dc1a3887 correction 2 years ago
  Max Megavolt c6ccbc21f9 correction 2 years ago
1 changed files with 29 additions and 21 deletions
  1. 29 21
      lognconf-report.sh

+ 29 - 21
lognconf-report.sh

@@ -4,6 +4,21 @@ set -o errexit  #>Exit when a command fails (returns non-zero)
 set -o pipefail #>Exit when a command within a pipeline fail (returns non-zero)
 set -o nounset  #>Forbid to use unse
 
+declare -A Paths
+Paths[sys]="$HOME"/lognconf_systeminfo.md
+Paths[log]="$HOME"/lognconf_logging.md
+Paths[url]="https://notabug.org/megavolt/random-scripts/raw/master/lognconf-report.sh"
+
+if [[ ! -t 0 ]] ; then 
+	echo "Pipe detected!"
+	echo "Please don't pipe the script. Run it like that:"
+	echo "* bash <(curl -s "${Paths[url]}")"
+	echo "* curl -s ${Paths[url]} > /tmp/lncr.sh && bash /tmp/lncr.sh"
+	echo "* bash lognconf-report.sh"
+	echo "* chmod +x lognconf-report.sh && ./lognconf-report.sh"
+	exit
+fi
+
 export LANG=C 
 
 declare -A BootConfigs
@@ -21,10 +36,6 @@ declare -A BootLogs
 BootLogs[xorgsys]='/var/log/'
 BootLogs[xorghme]="$HOME/.local/share/xorg/"
 
-declare -A Paths
-Paths[sys]="$HOME"/lognconf_systeminfo.md
-Paths[log]="$HOME"/lognconf_logging.md
-
 OutPut=""
 
 function GetINXI ()
@@ -169,20 +180,17 @@ InPut="$(GetSystemJournals current)"
 InPut="$(GetSystemJournals previous)"
 [[ -n "${InPut}" ]] && Logs+="\n\n#### Previous System Journals\n\n~~~\n${InPut}\n~~~\n\n"
 
-while true; do
-	read -p "Would you like to view [v] the content? (View[v]/No[n]) " vn
-	case $vn in
-		[Vv]) echo -e "${OutPut}""${Logs}" | less ;;
-		[Nn]) break ;;
-		*) continue ;;
-	esac
-done 
-
-while true; do
-	read -p "Would you like to upload [u] the content or write it to a file [s]? Save[s]/Upload[u] " us
-	case $us in
-		[Uu]) upload && exit ;;
-		[Ss]) save && exit ;;
-		*) continue ;;
-	esac
-done
+read -p "Would you like to view [v] the content? (View[V]/No[n]) " vn
+case $vn in
+	[Vv]) less -f <(echo -e "${OutPut}${Logs}") ;;
+	[Nn]) echo -n "" ;;
+	*) less -f <(echo -e "${OutPut}${Logs}") ;;
+esac
+
+read -p "Would you like to upload [u] the content or write it to a file [s]? Save[s]/Upload[U]" us
+case $us in
+	[Uu]) upload ;;
+	[Ss]) save ;;
+	*) upload ;;
+esac
+