zsh-users
 help / color / mirror / code / Atom feed
* Re: please advice
@ 2000-06-30 12:14 Sven Wischnowsky
  2000-06-30 12:17 ` Mircea Damian
  0 siblings, 1 reply; 7+ messages in thread
From: Sven Wischnowsky @ 2000-06-30 12:14 UTC (permalink / raw)
  To: zsh-users


Mircea Damian wrote:

> ...
> 
> I don't see what can be wrong if I use word splitting on that variable(btw,
> word splitting is done by using WORDCHARS or just white spaces?).. is there
> somewhere an impediment for that?

It uses the characters from $IFS for word splitting.

The advantage of using arrays is the easier handling if the words
contain spaces, which, of course, isn't important in your example (but 
it may be a good idea to get used to it anyway).

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


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

* Re: please advice
  2000-06-30 12:14 please advice Sven Wischnowsky
@ 2000-06-30 12:17 ` Mircea Damian
  0 siblings, 0 replies; 7+ messages in thread
From: Mircea Damian @ 2000-06-30 12:17 UTC (permalink / raw)
  To: Sven Wischnowsky; +Cc: zsh-users

On Fri, Jun 30, 2000 at 02:14:37PM +0200, Sven Wischnowsky wrote:
> 
> Mircea Damian wrote:
> 
> > ...
> > 
> > I don't see what can be wrong if I use word splitting on that variable(btw,
> > word splitting is done by using WORDCHARS or just white spaces?).. is there
> > somewhere an impediment for that?
> 
> It uses the characters from $IFS for word splitting.
> 
> The advantage of using arrays is the easier handling if the words
> contain spaces, which, of course, isn't important in your example (but 
> it may be a good idea to get used to it anyway).

Right. I haven't thought about that. In fact in my real program(not the
test case I wrote) it matters very much.


Thank you again,
> 
> Bye
>  Sven
> 
> 

-- 
Mircea Damian
E-mails: dmircea@kappa.ro, dmircea@roedu.net
WebPage: http://taz.mania.k.ro/~dmircea/


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

* Re: please advice
  2000-06-30 12:16   ` Andrej Borsenkow
@ 2000-06-30 12:21     ` Mircea Damian
  0 siblings, 0 replies; 7+ messages in thread
From: Mircea Damian @ 2000-06-30 12:21 UTC (permalink / raw)
  To: Andrej Borsenkow; +Cc: Sven Wischnowsky, zsh-users

On Fri, Jun 30, 2000 at 04:16:14PM +0400, Andrej Borsenkow wrote:
> 
> >
> > I don't see what can be wrong if I use word splitting on that
> > variable(btw,
> > word splitting is done by using WORDCHARS or just white
> > spaces?).. is there
> > somewhere an impediment for that?
> >
> 
>  Shell wordsplitting is using the value of IFS parameter. It should be
> compatible with current Unix standards (POSIX, XPG, SUS etc).
> 
> What is the meaning of "impediment"?

uh.. sorry! I've seen that "aspell" knows it so I thought that it has the
same meaning as in my language(romanian).

It means: some reason that stays in the way of an action

To be more clear:

  impediment
       n 1: something immaterial that interferes with or delays action
            or progress [syn: {hindrance}, {deterrent}, {handicap}]
       2: anything that makes progress difficult [syn: {obstruction},
          {impedimenta}]

(quote from WordNet)


-- 
Mircea Damian
E-mails: dmircea@kappa.ro, dmircea@roedu.net
WebPage: http://taz.mania.k.ro/~dmircea/


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

* RE: please advice
  2000-06-30 12:03 ` Mircea Damian
@ 2000-06-30 12:16   ` Andrej Borsenkow
  2000-06-30 12:21     ` Mircea Damian
  0 siblings, 1 reply; 7+ messages in thread
From: Andrej Borsenkow @ 2000-06-30 12:16 UTC (permalink / raw)
  To: Mircea Damian, Sven Wischnowsky; +Cc: zsh-users


>
> I don't see what can be wrong if I use word splitting on that
> variable(btw,
> word splitting is done by using WORDCHARS or just white
> spaces?).. is there
> somewhere an impediment for that?
>

 Shell wordsplitting is using the value of IFS parameter. It should be
compatible with current Unix standards (POSIX, XPG, SUS etc).

What is the meaning of "impediment"?

-andrej


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

* Re: please advice
  2000-06-30 11:39 Sven Wischnowsky
@ 2000-06-30 12:03 ` Mircea Damian
  2000-06-30 12:16   ` Andrej Borsenkow
  0 siblings, 1 reply; 7+ messages in thread
From: Mircea Damian @ 2000-06-30 12:03 UTC (permalink / raw)
  To: Sven Wischnowsky; +Cc: zsh-users

On Fri, Jun 30, 2000 at 01:39:48PM +0200, Sven Wischnowsky wrote:
> 
> One of the places where zsh differs from other shells, doing the right 
> thing.

Yes. This is true.

> 
> One possibility is to set the shwordsplit option, if you really want
> it everywhere. Our you can force word splitting for that one parameter 
> expansion by using: `$=PRGARG'.
> 
> The best way would be to use an array, though.
> 
>   PRGARG=(-bla1 -bla2 -bla3)
>   $0 $PRGARG

Ok. It was exactly the example that I followed from "dircolors -z".



I don't see what can be wrong if I use word splitting on that variable(btw,
word splitting is done by using WORDCHARS or just white spaces?).. is there
somewhere an impediment for that?

> 
> Bye
>  Sven

Thank you very much,


-- 
Mircea Damian
E-mails: dmircea@kappa.ro, dmircea@roedu.net
WebPage: http://taz.mania.k.ro/~dmircea/


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

* Re: please advice
@ 2000-06-30 11:39 Sven Wischnowsky
  2000-06-30 12:03 ` Mircea Damian
  0 siblings, 1 reply; 7+ messages in thread
From: Sven Wischnowsky @ 2000-06-30 11:39 UTC (permalink / raw)
  To: zsh-users


Mircea Damian wrote:

> Hello,
> 
> I'm trying to use and old bash script and port it to zsh.
> It now basically does:
> 
> #!/bin/zsh
> 
> 
> if [ $# -gt 0 ]; then
>   echo "Number of arguments: $#"
>   exit
> fi
> 
> PRGARG="-bla1 -bla2 -bla3"
> 
> $0 $PRGARG
> 
> 
> In zsh the number of arguments will be 1. How can I expand(?) it to three
> as bash does?

One of the places where zsh differs from other shells, doing the right 
thing.

One possibility is to set the shwordsplit option, if you really want
it everywhere. Our you can force word splitting for that one parameter 
expansion by using: `$=PRGARG'.

The best way would be to use an array, though.

  PRGARG=(-bla1 -bla2 -bla3)
  $0 $PRGARG

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


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

* please advice
@ 2000-06-30 11:27 Mircea Damian
  0 siblings, 0 replies; 7+ messages in thread
From: Mircea Damian @ 2000-06-30 11:27 UTC (permalink / raw)
  To: zsh-users


Hello,

I'm trying to use and old bash script and port it to zsh.
It now basically does:

#!/bin/zsh


if [ $# -gt 0 ]; then
  echo "Number of arguments: $#"
  exit
fi

PRGARG="-bla1 -bla2 -bla3"

$0 $PRGARG


In zsh the number of arguments will be 1. How can I expand(?) it to three
as bash does?



-- 
Mircea Damian
E-mails: dmircea@kappa.ro, dmircea@roedu.net
WebPage: http://taz.mania.k.ro/~dmircea/


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

end of thread, other threads:[~2000-06-30 12:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-30 12:14 please advice Sven Wischnowsky
2000-06-30 12:17 ` Mircea Damian
  -- strict thread matches above, loose matches on Subject: below --
2000-06-30 11:39 Sven Wischnowsky
2000-06-30 12:03 ` Mircea Damian
2000-06-30 12:16   ` Andrej Borsenkow
2000-06-30 12:21     ` Mircea Damian
2000-06-30 11:27 Mircea Damian

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).