zsh-users
 help / color / mirror / code / Atom feed
* Creating a Case statement dynamically
@ 2005-06-28 17:24 zzapper
  2005-06-28 17:58 ` Nikolai Weibull
  0 siblings, 1 reply; 4+ messages in thread
From: zzapper @ 2005-06-28 17:24 UTC (permalink / raw)
  To: zsh-users

Hi  Z-men


I have script which lists a series of files I might wish to edit

manuals/client-man-admin.tex
manuals/client-man-catalogbasket.tex
manuals/client-man-userguide.tex
quotes/client-admin.tex
quotes/client.tex

I'd like the script to dynamically output a case such


vared -p " Type number to edit or q" -c action
case $action in
 1) gvim manuals/clientman-admin.tex ;;
 2) gvim manuals/clientman-catalogbasket.tex ;;
 etc
 q) exit 0;;
 *) ;; # everything else including return: do nothing
esac

but how to do?

Alternative solutions welcome


-- 
zzapper
vim -c ":%s%s*%Cyrnfr)fcbafbe[Oenz(Zbbyranne%|:%s)[[()])-)Ig|norm Vg?"
http://www.rayninfo.co.uk/tips/ vim, zsh & success tips


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Creating a Case statement dynamically
  2005-06-28 17:24 Creating a Case statement dynamically zzapper
@ 2005-06-28 17:58 ` Nikolai Weibull
  2005-06-28 22:50   ` John Reese
  0 siblings, 1 reply; 4+ messages in thread
From: Nikolai Weibull @ 2005-06-28 17:58 UTC (permalink / raw)
  To: zsh-users

zzapper wrote:

> I have script which lists a series of files I might wish to edit
> 
> I'd like the script to dynamically output a case

Use an array/list and select the nth element from it,
        nikolai

-- 
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Creating a Case statement dynamically
  2005-06-28 17:58 ` Nikolai Weibull
@ 2005-06-28 22:50   ` John Reese
  2005-06-29 10:34     ` zzapper
  0 siblings, 1 reply; 4+ messages in thread
From: John Reese @ 2005-06-28 22:50 UTC (permalink / raw)
  To: zsh-users

2005/6/28, Nikolai Weibull <mailing-lists.zsh-users@rawuncut.elitemail.org>:
> zzapper wrote:
> 
> > I have script which lists a series of files I might wish to edit
> >
> > I'd like the script to dynamically output a case
> 
> Use an array/list and select the nth element from it,
>         nikolai
> 

I suggest the "select" loop.  For example:

select f in **/*.tex; do
  if [[ "$REPLY" = q ]]; then
    break
  elif [[ -n "$f" ]]; then
    gvim $f
  fi
done

Note that this block will loop until you exit with ^C or q.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Creating a Case statement dynamically
  2005-06-28 22:50   ` John Reese
@ 2005-06-29 10:34     ` zzapper
  0 siblings, 0 replies; 4+ messages in thread
From: zzapper @ 2005-06-29 10:34 UTC (permalink / raw)
  To: zsh-users

On Tue, 28 Jun 2005 15:50:54 -0700,  wrote:

>2005/6/28, Nikolai Weibull <mailing-lists.zsh-users@rawuncut.elitemail.org>:
>> zzapper wrote:
>> 
>> > I have script which lists a series of files I might wish to edit
>> >
>> > I'd like the script to dynamically output a case
>> 
>> Use an array/list and select the nth element from it,
>>         nikolai
>> 
>
>I suggest the "select" loop.  For example:
>
>select f in **/*.tex; do
>  if [[ "$REPLY" = q ]]; then
>    break
>  elif [[ -n "$f" ]]; then
>    gvim $f
>  fi
>done
>
>Note that this block will loop until you exit with ^C or q.
thx just what I was looking for!

-- 
zzapper
vim -c ":%s%s*%Cyrnfr)fcbafbe[Oenz(Zbbyranne%|:%s)[[()])-)Ig|norm Vg?"
http://www.rayninfo.co.uk/tips/ vim, zsh & success tips


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-06-29 10:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-28 17:24 Creating a Case statement dynamically zzapper
2005-06-28 17:58 ` Nikolai Weibull
2005-06-28 22:50   ` John Reese
2005-06-29 10:34     ` zzapper

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).