这是在日常使用Linux系统中编写的脚本,主要用来打开一些软件,但是为了不影响本机的环境,环境变量采用动态导入的方式,部分路径使用了绝对路径,比较简单,略作记录

#!/bin/bash

function openSS(){

 cd ~/MyFile/

./Shadowsocks-Qt5-3.0.1-x86_64.AppImage

   return 0;
}

function openJadX(){
#导入java环境变量
export JAVA_HOME=/home/misty/MyFile/jdk1.8.0_211

export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

export PATH=$PATH:$JAVA_HOME/bin:

cd /home/misty/MyFile/jadx/bin
./jadx-gui

return 0;

}

function openViewer(){
export JAVA_HOME=/home/misty/MyFile/jdk1.8.0_211

export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

export PATH=$PATH:$JAVA_HOME/bin:

cd /home/misty/Android/Sdk/tools/bin

source ./uiautomatorviewer

return 0;
}

function openJeb(){
export JAVA_HOME=/home/misty/MyFile/jdk1.8.0_211

export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

export PATH=$PATH:$JAVA_HOME/bin:


cd /home/misty/MyFile/Jeb
chmod 755 jeb_linux.sh
./jeb_linux.sh

return 0;
}

echo "Please input intention like that: "
echo '1|ss to start shadowsockss'
echo '2|jadx to open JadX-gui'
echo '3|viewer open viewer to help accessibility'
echo '4|jeb to start jeb'
echo '5: [待补充]'

read -t 30 -p "look the command of top and try option :" command
case $command in
       # 注意这里不可以加上引号将表达式引起来 
    1|ss)
        echo "open shadowsocks..."
        openSS
        ;;

    "2"|"jadx")
        echo "start jadx-gui..."
        openJadX    
        ;;
    3|viewer) 
        echo "start uiautomatorviewer..."
        openViewer
        ;;

    4|jeb)
        echo "opening jeb "
        openJeb
        ;;
    *)
        echo "input valid..."
        exit 233
        ;;
    esac
exit 0  




#-------------version_1.0已废弃------------------------------
#read -t 30 -p 'Please input intention : you can try input "ss | jadx | viewer"' command

#if [ "$command" == "ss" ] 
#   then 
#   openSS
#elif [ "$command" == jadx ]
#   then 
#   openJadX
#elif [ "$command" == viewer ]
#   then 
#        openViewer    

#else 
#   echo " input valid "

#fi