summaryrefslogtreecommitdiff
path: root/bash/check_Cl.sh
blob: 563e3a1f68f800eefd5c78e39f7af9c0721f4b00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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"