blob: 03bb09dfcdb02b1536f52c8d413994a064d77d04 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#!/bin/bash
2
3CMD_SET="gawk gcc bison flex pkg-config"
4PACKAGE_SET=("gawk" "build-essential" "bison" "flex" "pkg-config")
5RET_VALUE=0
6
7function checkCmd()
8{
9 cmd=$1
10 i=$2
11 which $cmd > /dev/null 2>&1
12 if [ $? -eq 0 ]; then
13 echo "check command $cmd ok"
14 else
15 echo "[ERROR]check command $cmd fail, Maybe run [ sudo apt-get install ${PACKAGE_SET[i]} ] to install"
16 return 1
17 fi
18}
19
20i=0
21for item in $CMD_SET;do
22 checkCmd $item $i
23 if [ $? -ne 0 ]; then
24 RET_VALUE=1
25 fi
26 let "i=i+1"
27done
28
29exit $RET_VALUE
30