* scripting problem: vi and multiple arguments
@ 1998-11-04 20:25 Jason Price
1998-11-04 20:43 ` Michael Barnes
0 siblings, 1 reply; 3+ messages in thread
From: Jason Price @ 1998-11-04 20:25 UTC (permalink / raw)
To: zsh-users
I'm writing a front end to RCS. (very very small) to deal with people
being forgetful about removing file locks.
I want to parse the command line to the script like this:
rvi file1 file2...
And then I want to call vi like this:
vi file1 file2
however, as I loop through the arguments to rvi, unlocking as needed, yadda
yadda, I build a variable called $EDFILES
then I call
vi $EDFILES
however, zsh is sending all of $EDFILES to vi as one string to argv[1]. I
want each entry in $EDFILES to be a seperate entry into argv.
How can I do this?
Should I build $EDFILES differently?
I could do:
for i in $EDFILES; do
vi $i
done
but that would be different from how vi works with multiple files, and I
want this to be as seamless as possible....
RTFM's welcome with a pointer to the right FM.
Thanks for any help;
Jason
--
"Where will I go?" "Somewhere where they know nothing about computing...
Where they wouldn't know a RAM chip from a potato chip!"
"But I don't want to visit Microsoft!" --the PFY and the BOFH
Jason Price jprice@gatech.edu Theta Xi, Beta Alpha 449
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: scripting problem: vi and multiple arguments
1998-11-04 20:25 scripting problem: vi and multiple arguments Jason Price
@ 1998-11-04 20:43 ` Michael Barnes
1998-11-04 21:08 ` Jason Price
0 siblings, 1 reply; 3+ messages in thread
From: Michael Barnes @ 1998-11-04 20:43 UTC (permalink / raw)
To: zsh-users
use $EDFILES as an array, im not sure how that gets set but do something
like
EDFILES=(*.c)
EDFILES=($EDFILES *.h)
then
vi $EDFILES
will do what you like, it will expand to a list of values and not one
string.
look under the zsh parameters manual or info section for more info.
Mike
On Wed, Nov 04, 1998 at 03:25:18PM -0500, Jason Price wrote:
> I'm writing a front end to RCS. (very very small) to deal with people
> being forgetful about removing file locks.
>
> I want to parse the command line to the script like this:
>
> rvi file1 file2...
>
> And then I want to call vi like this:
>
> vi file1 file2
>
> however, as I loop through the arguments to rvi, unlocking as needed, yadda
> yadda, I build a variable called $EDFILES
>
> then I call
>
> vi $EDFILES
>
> however, zsh is sending all of $EDFILES to vi as one string to argv[1]. I
> want each entry in $EDFILES to be a seperate entry into argv.
>
> How can I do this?
>
> Should I build $EDFILES differently?
>
> I could do:
>
> for i in $EDFILES; do
> vi $i
> done
>
> but that would be different from how vi works with multiple files, and I
> want this to be as seamless as possible....
>
> RTFM's welcome with a pointer to the right FM.
>
> Thanks for any help;
> Jason
>
> --
> "Where will I go?" "Somewhere where they know nothing about computing...
> Where they wouldn't know a RAM chip from a potato chip!"
> "But I don't want to visit Microsoft!" --the PFY and the BOFH
> Jason Price jprice@gatech.edu Theta Xi, Beta Alpha 449
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: scripting problem: vi and multiple arguments
1998-11-04 20:43 ` Michael Barnes
@ 1998-11-04 21:08 ` Jason Price
0 siblings, 0 replies; 3+ messages in thread
From: Jason Price @ 1998-11-04 21:08 UTC (permalink / raw)
To: zsh-users
"Michael Barnes" <mibarnes@vt.edu> writes:
> use $EDFILES as an array, im not sure how that gets set but do something
> like
>
> EDFILES=(*.c)
> EDFILES=($EDFILES *.h)
> then
>
> vi $EDFILES
Thanks... That's exactly what I needed.
I went from building EDIFLES (in the loop) like:
EDFILES=`echo "$EDFILES $i"`
to
EDFILES=($EDFILES $i)
and everything became golden.
Thanks again;
Jason
--
"Where will I go?" "Somewhere where they know nothing about computing...
Where they wouldn't know a RAM chip from a potato chip!"
"But I don't want to visit Microsoft!" --the PFY and the BOFH
Jason Price jprice@gatech.edu Theta Xi, Beta Alpha 449
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1998-11-04 21:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-11-04 20:25 scripting problem: vi and multiple arguments Jason Price
1998-11-04 20:43 ` Michael Barnes
1998-11-04 21:08 ` Jason Price
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).