On 4/20/06, ray hammond <[EMAIL PROTECTED]> wrote:
> I'm getting closer! Here is my latest script
>
> -----------Start -------------------
> #!/usr/bin/fish
>
> if test "$OPSYSTEM" = "TANDEM";
> function VIEWER; more; end
> else
> function VIEWER; less; end
> end
>
> set menu ""
>
> while test "$menu" != "x";
>
> tput clear
> tput smso
> echo 'Sample menu'
> tput rmso
> echo '1. Show disk space'
> echo '2. Show uptime'
> echo '3. Show /var/log/messages'
> echo '4. Show /etc/hosts'
> echo '5. Show network configuration'
> echo 'x. Exit to shell'
> echo ''
> echo 'Select Option [1 - 5 or x to Return] :'
> tput cup 10 38
>
> read menu
>
> tput clear
>
> switch $menu
> case 1
> df -H
> case 2
> uptime
> case 3
> tail /var/log/messages
> case 4
> cat /etc/hosts | VIEWER
> case 5
> ifconfig | VIEWER
> end
>
> echo '** Press <ENTER> **'
>
> set press ""
> read press
>
> end
> -----------End -------------------
>
> The menu prints fine, the reverse video works and the menu options function.
> However the tput cup command still misses the spot I get the following
> output
>
> -----------Start -------------------:
> Sample menu
> 1. Show disk space
> 2. Show uptime
> 3. Show /var/log/messages
> 4. Show /etc/hosts
> 5. Show network configuration
> x. Exit to shell
>
> Select Option [1 - 5 or x to Return] :
>
> read>
> -----------End -------------------
>
> The prompt is placed after the "read>" statement. I'm not sure were the
> "read" label comes from, I didn't ask for.
As I mentioned in a previous mail, read under fish is actually a
fullblown prompt. I'd suggest you use this to your advantage by
replacing:
echo 'Select Option [1 - 5 or x to Return] :'
tput cup 10 38
read menu
with:
read -p 'echo "Select Option [1 - 5 or x to Return] : "' menu
If you do not want the prompt, you can specify 'read -p ""', but that
will still move the cursor to the leftmost part of the screen. You
will also notice that the read command has all the features of the
regular fish shell, like a history list, X clipboard support, etc.
>
>
> -----Original Message-----
> From: Axel Liljencrantz [mailto:[EMAIL PROTECTED]
> Sent: 20 April 2006 09:35
> To: [EMAIL PROTECTED]
> Cc: ray hammond; [email protected]
> Subject: Re: [Fish-users] tput commands
>
> On 4/20/06, Philip Ganchev <[EMAIL PROTECTED]> wrote:
> > On 4/19/06, ray hammond <[EMAIL PROTECTED]> wrote:
> > [...]
> > > switch $menu
> > [....]
> > > case 4
> > > cat /etc/hosts | $VIEWER
> > > case 5
> > > ifconfig | $VIEWER
> > > end
> >
> > This will not work either because Fish does not expand "$VIEWER":
> >
> > fish> echo $VIEWER
> > more
> >
> > fish> echo hello | more
> > hello
> >
> > fish> echo hello | $VIEWER
> > fish: Unknown command $VIEWER
> > echo hello | $VIEWER
> > ^
> >
> > (The arrow above is under the "$".)
> >
>
> Oh, right. Never tried those alternatives. Here is how to do this
> properly in fish:
>
> if test "$OPSYSTEM" = "TANDEM";
> function viewer; more; end
> else
> function viewer; less; end
> end
>
> ...
>
> case 4
> cat /etc/hosts | viewer
> case 5
> ifconfig | viewer
> end
>
>
> --
> Axel
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.385 / Virus Database: 268.4.4/319 - Release Date: 19/04/2006
>
>
>
--
Axel
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users