Results 1 to 9 of 9
Hi All
I'm trying to make a very simple menu in bash for launching apps, and to allow me to view log files. The idea is so I won't have ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 09-27-2005 #1
Simple bash script
Hi All
I'm trying to make a very simple menu in bash for launching apps, and to allow me to view log files. The idea is so I won't have to remember the locations of all the logs, I can just load the script and then just pick them from the menu. This is what I got so far, but the 'viewlogs' option does nothing. Any ideas why the 'more' command wouldn't do anything here?
I will add a lot more to this once I've mastered the basic syntax.Code:#! /bin/sh viewlog() { /bin/more /home/vpopmail/qtrap/logs/qtrap.log pause f_menu } queuel() { queue -l } spamconfig() { pico /etc/mail/spamassassin/local.cf } f_menu() { tput clear cat << EOF QMail Admin Menu 1) View QTrap Log 2) View QMail Queue 3) Edit SpamAssassin config Q) Quit EOF echo -n "Prompt> " read _my_choice case "$_my_choice" in 1) viewlog ;; 2) queuel ;; 3) spamconfig ;; Q|q) exit ;; esac } f_menu
Registered Linux user #389109
My Semi-Linux Blog
- 09-27-2005 #2
Looking at the script and trying it myself, the only thing that I could do to replicate your problem was to have the wrong path for the logfile. So check this. Also you might want to use less rather than more, since less let's you scroll up and down the output, while more only let's you scroll down.
- 09-27-2005 #3Linux Engineer
- Join Date
- Jan 2005
- Location
- Chicago (USA)
- Posts
- 1,028
Two suggestions:
1. Use less instead of more. You can scroll back up in less.
2. Use nano instead of pico. Nano's a clone of pico under the GPL.
- 09-28-2005 #4
Cheers for the tip on using 'less' instead of more.
dylunio: you were on the right lines, the file exists but is completely empty which is why nothing displays.
a thing: where do I get nano? I would really prefer to use vi, but it just behaves too strangly on slackware.Registered Linux user #389109
My Semi-Linux Blog
- 09-28-2005 #5
If you want nano check out it's site http://www.nano-editor.org/, as for vi behaving strangely in Slack, you might have been used to VIM (Vi IMproved), not vi, ofter vi is symlinked to vim on systems that use vim instead of vi. To grab VIM, go to http://www.vim.org/.
- 09-28-2005 #6Linux Engineer
- Join Date
- Mar 2005
- Posts
- 1,431
Check the file /etc/vim/vimrc (or ~user/.vimrc). I belive you can make vim behave "classic vi" or in the new mode like this (token from my /etc/vim/vimrc):
Originally Posted by stokes Try adding that...Code:set nocompatible
About nano, look here:
http://www.nano-editor.org/download.html
- 09-28-2005 #7Cool! That's back to the way I'm used to. Nice one!
Originally Posted by dylunio
Registered Linux user #389109
My Semi-Linux Blog
- 09-28-2005 #8Glad you sorted it
Originally Posted by stokes
- 09-29-2005 #9Linux Engineer
- Join Date
- Mar 2005
- Posts
- 1,431
I thought slack used vim by default? (symlinked vi as you said)


Reply With Quote
