I have A question regarding the menu in shell scripting. I created a menu in shell scripting. however, in one of the options, I have a list the user can select from but the list is big, so I want the user to select the option from a file. how do we do that?
:select_menu
cls
echo.
echo ====================
echo Main Menu
echo ====================
echo 1 =Airport
echo 2 =Warhouse
echo 3 =Parcel
echo 4 =Other Projects
echo ------------------------------------------------------
echo q = Quit
echo -------------------------------------------------------
set /p op="Select option:"
if "%op%"=="1" goto op1
if "%op%"=="2" goto op2
if "%op%"=="3" goto op3
if "%op%"=="4" goto op4
if "%op%"=="q" exit
:op1
color 17
cls
echo.
echo ====================
echo Airport Menu
echo ====================
echo 1 =Gotenburge
echo 2 =Heathrow
echo 3 =Brussels
echo 4 =Kiev
echo ------------------------------------------------------
echo r = Return to Main Menu
echo -------------------------------------------------------
set /p a_op="Select airport:"
if "%a_op%"=="1" echo "Contact A.N.OTher" && pause
if "%a_op%"=="2" echo "Contact B.N.OTher" && pause
if "%a_op%"=="3" echo "Contact B.N.OTher" && pause
if "%a_op%"=="4" echo "Contact C.N.OTher" && pause
if "%a_op%"=="r" goto select_menu
goto op1
:op2
echo you selected Warhouse
color 0a
pause
cls
goto begin
goto :eof
:op3
echo you selected Parcel
color fc
pause
cls
goto begin
:op4
echo you selected Other Projects
color a1
pause
cls
goto begin
:exit
In the Airport Menu, I have 250 airports as an example but I don't want to list all airports, I want the user to be able to check a separate file called Airport_list then choose the relevant option.
Asked by sun moon
(1 rep)
May 29, 2023, 11:58 AM
Last activity: May 29, 2023, 04:45 PM
Last activity: May 29, 2023, 04:45 PM