I notice so many packages, or program installers just use a "bash script" to do the job,
and "bash" is maybe the most powerful tool that comes with Debian, and other linux distros. So I decided to start trying to do something with it.
So this is my first project, been looking at some tutorials, and have lots of links to some pretty good ones. But any way, I am trying to learn about making a multi choice menu.
I found some examples in different tutorials,the example I used, just had 2 options, and neither really did anything.
It just:
1 . printed and displayed a "hello world", 2 . quit ... so I looked some more, and did figure out how to get option 1. start the w3m web browser, that works fine. I added options 1 thru 6 and it show 7 options, including the "quit" option.
Problem, no matter how I try to add the 2nd option, I get errors, I tried all sorts of places, and remove the lines, that the error message showed to be "error", still no, went back to the tutorial, but do not find anything I can understand, maybe some other tutorial, but any way, maybe someone can help get me going on this too,.. here is what I have so far.
The first part works great, when I select 1 it start the w3m browser, and connects here,
when I quit the browser, it does not return to the menu.
---edited:"it returns to the menu",..should have been:
script#1
Code: Select all
#!/bin/bash
OPTIONS="1 2 3 4 5 6 Quit"
select opt in $OPTIONS; do
if [ "$opt" = "Quit" ]; then
echo done
exit
elif [ "$opt" = "1" ]; then
while w3m http://forums.debian.net
echo done
exit
do
true
done
else
clear
echo bad option
fi
done
[/ code]
#---------------------------------
#This would be the "option 2 " but when I try to add it I get errors, seems like no matter where I add it.
elif [ "$opt" = "2" ]; then
while display
echo done
exit
Option 2 is to start "imagemagick", "display" is the cli command to start it.
Maybe it does not use the "elif", so I tried "if" and that does not work ? anyway I got tired , I used to be able to do some menus pretty easy, but it was with "qbasic", and I have forgotten a lot of that, but any way "bash" is not the same,..
I also am going to look at
Code: Select all
man bash
I might find what I need there,..as busy as I am , it will be a while, doing this via the manual and tutorials, it is a simple enough script, I am hoping some one that knows bash scripting better, can give a example, to help speed this up. It is just a small piece, of another project I am starting. More on that later
thanks,