summaryrefslogtreecommitdiff
path: root/bash
diff options
context:
space:
mode:
Diffstat (limited to 'bash')
-rwxr-xr-xbash/check_Cl.sh34
-rwxr-xr-xbash/extractZip.sh43
-rwxr-xr-xbash/list_all_file.sh23
-rw-r--r--bash/quickExtract.sh16
-rwxr-xr-xbash/update_bt.sh13
5 files changed, 129 insertions, 0 deletions
diff --git a/bash/check_Cl.sh b/bash/check_Cl.sh
new file mode 100755
index 0000000..563e3a1
--- /dev/null
+++ b/bash/check_Cl.sh
@@ -0,0 +1,34 @@
+#! /bin/sh
+
+prefix="syscfg addbyte"
+file=cl.txt
+
+if [[ $# -gt 2 ]]; then
+ echo "Incorrect argument"
+elif
+ [[ $# -eq 2 ]]; then
+ file=${2}.txt
+fi
+
+if [[ ! -f $1 ]]; then
+ echo "File not exists"
+ exit
+fi
+
+func() {
+ p="$(echo $prefix $1)"
+
+ if [ $1 == "BLCl" ]; then
+ echo "$(grep "${prefix} $1" "$2" | tail -n1 | tr -s '[:space:]' | rev | cut -d ' ' -f 1 | rev) insight color cal $1" >> $file
+ else
+ echo "$(grep "${prefix} $1" "$2" | head -n1 | tr -s '[:space:]' | rev | cut -d ' ' -f 1 | rev) insight pre color cal $1" >> $file
+ echo "$(grep "${prefix} $1" "$2" | tail -n1 | tr -s '[:space:]' | rev | cut -d ' ' -f 1 | rev) insight post color cal $1" >> $file
+ fi
+
+# echo "0x$(sysconfig read -k $1 | tr -d '[:space:]' | rev | cut -d '|' -f 1 | rev) System $1" >> $file
+ echo "" >> $file
+}
+
+func "BLCl" "$1"
+func "GLCl" "$1"
+func "DPCl" "$1"
diff --git a/bash/extractZip.sh b/bash/extractZip.sh
new file mode 100755
index 0000000..b0f38d8
--- /dev/null
+++ b/bash/extractZip.sh
@@ -0,0 +1,43 @@
+#!/bin/zsh
+
+tmpDir="Files/"
+
+directory() {
+ flag="d"
+ cd "$1"
+
+ for file in *.zip; do
+ dirName=$(getFilePath "$flag" "$file")
+ if [ -d "$dirName" ]; then
+ rm -r "$dirName"
+ fi
+
+ mkdir -p "$dirName"
+
+ tar zxf "$file" -C "$dirName"
+ done
+}
+
+run() {
+ if [ $# -lt 1 ]; then
+ echo "operator: bad use"
+ exit 1
+
+ elif [ $n -eq 1 ]; then
+ if [ -d "$1" ]; then
+ directory "$@"
+
+# elif [ -f $1 ]; then
+# files "$@"
+
+ else
+ echo "$0: wrong file"
+
+ fi
+
+# else
+# files "$@"
+ fi
+}
+
+run "$@"
diff --git a/bash/list_all_file.sh b/bash/list_all_file.sh
new file mode 100755
index 0000000..c9d8831
--- /dev/null
+++ b/bash/list_all_file.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env sh
+
+######################################################################
+# @author : Garhve (garhve@gmail.com)
+# @file : p
+# @created : Friday Nov 04, 2022 19:22:17 CST
+#
+# @description :
+######################################################################
+
+
+function list() {
+ for x in "$1"/*; do
+ if [ -d "$x" ]; then
+ echo "$x";
+ list "$x"
+ else
+ echo "$x"
+ fi
+ done
+}
+
+list "$1"
diff --git a/bash/quickExtract.sh b/bash/quickExtract.sh
new file mode 100644
index 0000000..f1dbb0d
--- /dev/null
+++ b/bash/quickExtract.sh
@@ -0,0 +1,16 @@
+#!/usr/bin/env sh
+
+######################################################################
+# @author : garhve (dev@garhve.com)
+# @file : quickExtract
+# @created : Saturday Nov 26, 2022 13:27:09 CST
+#
+# @description : Extract log file by given address
+#
+# @usage : quickExtract dir loc_file
+######################################################################
+
+extract() {
+ cd "$1"
+
+ generalPath
diff --git a/bash/update_bt.sh b/bash/update_bt.sh
new file mode 100755
index 0000000..5023308
--- /dev/null
+++ b/bash/update_bt.sh
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+site=https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all.txt
+
+file=/home/pi/aria2-config/aria2.conf
+
+Addr=pi@192.168.1.104
+
+current="bt-tracker=$(curl $site | tr -s '[:space:]' | tr '[:space:]' ',')"
+
+
+#sshpass -p 'cctv7701' ssh -T $Addr "sed -i 's|$(grep -A 1 bt-trackers $file)|'\"${current}\"'|' $file"
+$(sshpass -p 'cctv7701' ssh -T $Addr "sed -i '410d' $file | echo $current >> $file")