Shortened script
This commit is contained in:
parent
3b6264661f
commit
faf287f57b
93
shellMen
93
shellMen
|
@ -66,38 +66,17 @@ while [ $i -le $x ]; do
|
||||||
preComment=$(grep -A 0 "Comment=" /usr/share/applications/"$line1")
|
preComment=$(grep -A 0 "Comment=" /usr/share/applications/"$line1")
|
||||||
execCMD=$(echo "${filename}) exec ${filename} ;;")
|
execCMD=$(echo "${filename}) exec ${filename} ;;")
|
||||||
|
|
||||||
if [[ "$catagory" == *"${menu[0]}"* ]] || [[ "$catagory" == *"${menu[1]}"* ]]; then
|
writeToPath "$catagory" "$execCMD"
|
||||||
echo "$execCMD" >> /tmp/sysMENU/"${menu[0]}".sh
|
|
||||||
elif [[ "$catagory" == *"${menu[2]}"* ]] \
|
|
||||||
|| [[ "$catagory" == *"${menu[3]}"* ]] \
|
|
||||||
|| [[ "$catagory" == *"${menu[4]}"* ]]; then
|
|
||||||
echo "$execCMD" >> /tmp/sysMENU/"${menu[2]}".sh
|
|
||||||
elif [[ "$catagory" == *"${menu[5]}"* ]]; then
|
|
||||||
echo "$execCMD" >> /tmp/sysMENU/"${menu[5]}".sh
|
|
||||||
elif [[ "$catagory" == *"${menu[6]}"* ]]; then
|
|
||||||
echo "$execCMD" >> /tmp/sysMENU/"${menu[6]}".sh
|
|
||||||
elif [[ "$catagory" == *"${menu[7]}"* ]] || [[ "$catagory" == *"${menu[8]}"* ]] ; then
|
|
||||||
echo "$execCMD" >> /tmp/sysMENU/"${menu[7]}".sh
|
|
||||||
elif [[ "$catagory" == *"${menu[9]}"* ]]; then
|
|
||||||
echo "$execCMD" >> /tmp/sysMENU/"${menu[8]}".sh
|
|
||||||
elif [[ "$catagory" == *"${menu[10]}"* ]]; then
|
|
||||||
echo "$execCMD" >> /tmp/sysMENU/"${menu[10]}".sh
|
|
||||||
elif [[ "$catagory" == *"${menu[11]}"* ]]; then
|
|
||||||
echo "$execCMD" >> /tmp/sysMENU/"${menu[11]}".sh
|
|
||||||
elif [[ "$catagory" == *"${menu[12]}"* ]]; then
|
|
||||||
echo "$execCMD" >> /tmp/sysMENU/"${menu[12]}".sh
|
|
||||||
elif [[ "$catagory" == *"${menu[13]}"* ]]; then
|
|
||||||
echo "$execCMD" >> /tmp/sysMENU/"${menu[13]}".sh
|
|
||||||
fi
|
|
||||||
i=$[$i++1];
|
i=$[$i++1];
|
||||||
done
|
done
|
||||||
|
|
||||||
for opt in "${menu[@]}"; do
|
for opt in "${menu[@]}"; do
|
||||||
if [[ opt == "${menu[8]}" ]]; then
|
if [[ $opt == "${menu[8]}" ]]; then
|
||||||
opt=${menu[7]}
|
opt=${menu[7]}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ opt == "${menu[3]}" || opt == "${menu[4]}" ]]; then
|
if [[ $opt == "${menu[3]}" || $opt == "${menu[4]}" ]]; then
|
||||||
opt=${menu[2]}
|
opt=${menu[2]}
|
||||||
fi
|
fi
|
||||||
echo "esac" >> /tmp/sysMENU/"${opt}".sh
|
echo "esac" >> /tmp/sysMENU/"${opt}".sh
|
||||||
|
@ -120,6 +99,40 @@ while [ $i -le $x ]; do
|
||||||
comment=$(sed s/"Comment="//g <<< ${preComment})
|
comment=$(sed s/"Comment="//g <<< ${preComment})
|
||||||
inputer=$(echo "$filename "\"$comment"\" \\")
|
inputer=$(echo "$filename "\"$comment"\" \\")
|
||||||
|
|
||||||
|
writeToPath "$catagory" "$inputer"
|
||||||
|
|
||||||
|
i=$[$i++1];
|
||||||
|
done
|
||||||
|
|
||||||
|
endMenuInsert=$(echo "2>"\"'${INPUT}'"\"")
|
||||||
|
menuitmVar=$(echo 'menuitem=$(<"${INPUT}")')
|
||||||
|
preCMD=$(echo "case \$menuitem in")
|
||||||
|
menuCall=$(echo "Main_Menu) bash /bin/shellMen ;;")
|
||||||
|
|
||||||
|
|
||||||
|
for opt in "${menu[@]}"; do
|
||||||
|
if [[ $opt == "${menu[8]}" ]]; then
|
||||||
|
opt=${menu[7]}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $opt == "${menu[3]}" || $opt == "${menu[4]}" ]]; then
|
||||||
|
opt=${menu[2]}
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$endMenuInsert" >> /tmp/sysMENU/"${opt}".sh
|
||||||
|
echo "$menuitmVar" >> /tmp/sysMENU/"${opt}".sh
|
||||||
|
echo "$preCMD" >> /tmp/sysMENU/"${opt}".sh
|
||||||
|
echo "$menuCall" >> /tmp/sysMENU/"${opt}".sh
|
||||||
|
done
|
||||||
|
|
||||||
|
commandInsert;
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeToPath() {
|
||||||
|
catagory=$1
|
||||||
|
inputer=$2
|
||||||
|
|
||||||
|
|
||||||
if [[ "$catagory" == *"${menu[0]}"* ]] || [[ "$catagory" == *"${menu[1]}"* ]]; then
|
if [[ "$catagory" == *"${menu[0]}"* ]] || [[ "$catagory" == *"${menu[1]}"* ]]; then
|
||||||
echo "$inputer" >> /tmp/sysMENU/"${menu[0]}".sh
|
echo "$inputer" >> /tmp/sysMENU/"${menu[0]}".sh
|
||||||
elif [[ "$catagory" == *"${menu[2]}*" ]] \
|
elif [[ "$catagory" == *"${menu[2]}*" ]] \
|
||||||
|
@ -143,33 +156,9 @@ while [ $i -le $x ]; do
|
||||||
elif [[ "$catagory" == *"${menu[13]}"* ]]; then
|
elif [[ "$catagory" == *"${menu[13]}"* ]]; then
|
||||||
echo "$inputer" >> /tmp/sysMENU/"${menu[13]}".sh
|
echo "$inputer" >> /tmp/sysMENU/"${menu[13]}".sh
|
||||||
fi
|
fi
|
||||||
i=$[$i++1];
|
|
||||||
done
|
|
||||||
|
|
||||||
endMenuInsert=$(echo "2>"\"'${INPUT}'"\"")
|
|
||||||
menuitmVar=$(echo 'menuitem=$(<"${INPUT}")')
|
|
||||||
preCMD=$(echo "case \$menuitem in")
|
|
||||||
menuCall=$(echo "Main_Menu) bash /bin/shellMen ;;")
|
|
||||||
|
|
||||||
|
|
||||||
for opt in "${menu[@]}"; do
|
|
||||||
if [[ opt == "${menu[8]}" ]]; then
|
|
||||||
opt = ${menu[7]}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ opt == "${menu[3]}" || opt == "${menu[4]}" ]]; then
|
|
||||||
opt = ${menu[2]}
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "$endMenuInsert" >> /tmp/sysMENU/"${opt}".sh
|
|
||||||
echo "$menuitmVar" >> /tmp/sysMENU/"${opt}".sh
|
|
||||||
echo "$preCMD" >> /tmp/sysMENU/"${opt}".sh
|
|
||||||
echo "$menuCall" >> /tmp/sysMENU/"${opt}".sh
|
|
||||||
done
|
|
||||||
|
|
||||||
commandInsert;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
startScan() {
|
startScan() {
|
||||||
clear
|
clear
|
||||||
mkdir /tmp/sysMENU
|
mkdir /tmp/sysMENU
|
||||||
|
@ -185,11 +174,11 @@ dialog --clear --backtitle "Shellmen" \
|
||||||
Main_Menu "Goes To Main Menu" \'''
|
Main_Menu "Goes To Main Menu" \'''
|
||||||
|
|
||||||
for opt in "${menu[@]}"; do
|
for opt in "${menu[@]}"; do
|
||||||
if [[ opt == "${menu[8]}" ]]; then
|
if [[ $opt == "${menu[8]}" ]]; then
|
||||||
opt=${menu[7]}
|
opt=${menu[7]}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ opt == "${menu[3]}" || opt == "${menu[4]}" ]]; then
|
if [[ $opt == "${menu[3]}" || $opt == "${menu[4]}" ]]; then
|
||||||
opt=${menu[2]}
|
opt=${menu[2]}
|
||||||
fi
|
fi
|
||||||
echo "$header" > /tmp/sysMENU/"${opt}".sh
|
echo "$header" > /tmp/sysMENU/"${opt}".sh
|
||||||
|
|
Loading…
Reference in New Issue