Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.unix.shell > #4212

Re: how to get arguments in a function split according to certain delimiters?

From Paul Branon <paulbranon@googlemail.com>
Newsgroups comp.unix.shell
Subject Re: how to get arguments in a function split according to certain delimiters?
Date 2012-02-27 05:26 -0800
Organization http://groups.google.com
Message-ID <d02a2e00-faaf-4fe4-b77a-7258e0e00a3d@eb6g2000vbb.googlegroups.com> (permalink)
References <97de1354-edd8-4eec-a660-8e921f55b326@s7g2000vby.googlegroups.com> <barmar-922110.01422927022012@news.eternal-september.org> <5647a316-33b3-436a-94c6-6e948eb554ab@d17g2000vba.googlegroups.com>

Show all headers | View raw


On Feb 27, 11:20 am, Paul Branon <paulbra...@googlemail.com> wrote:
> On Feb 27, 6:42 am, Barry Margolin <bar...@alum.mit.edu> wrote:
>
>
>
>
>
>
>
>
>
> > In article
> > <97de1354-edd8-4eec-a660-8e921f55b...@s7g2000vby.googlegroups.com>,
>
> >  Selva <kobu.se...@gmail.com> wrote:
> > > bash-3.2$ set | grep IFS
> > > IFS=:
> > > bash-3.2$ echo jungles:of:brazil
> > > jungles:of:brazil
>
> > > I want echo to get the arguments: 1=jungles, 2=of, 3=brazil
>
> > foo=jungles:of:brazil
> > echo $foo
>
> > --
> > Barry Margolin, bar...@alum.mit.edu
> > Arlington, MA
> > *** PLEASE post questions in newsgroups, not directly to me ***
>
> Barry, what does that do? Doesn't it just echo "jungles:of:brazil"
> which is not what the op wants

I added quotes to Barry's suggestion and tripped myself up.
quotes, quotes, quotes!!!


IFS=:; foo="jungles:of:brazil"; echo $foo

and

IFS=:; foo="jungles:of:brazil"; echo "$foo"

Back to comp.unix.shell | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

how to get arguments in a function split according to certain delimiters? Selva <kobu.selva@gmail.com> - 2012-02-26 21:49 -0800
  Re: how to get arguments in a function split according to certain delimiters? Barry Margolin <barmar@alum.mit.edu> - 2012-02-27 01:42 -0500
    Re: how to get arguments in a function split according to certain delimiters? Paul Branon <paulbranon@googlemail.com> - 2012-02-27 03:20 -0800
      Re: how to get arguments in a function split according to certain delimiters? "Mirko K." <mirkok.lists@googlemail.com> - 2012-02-27 13:35 +0100
      Re: how to get arguments in a function split according to certain delimiters? Janis Papanagnou <janis_papanagnou@hotmail.com> - 2012-02-27 13:38 +0100
      Re: how to get arguments in a function split according to certain delimiters? Paul Branon <paulbranon@googlemail.com> - 2012-02-27 05:26 -0800
        Re: how to get arguments in a function split according to certain delimiters? Barry Margolin <barmar@alum.mit.edu> - 2012-02-27 11:25 -0500
  Re: how to get arguments in a function split according to certain delimiters? Paul Branon <paulbranon@googlemail.com> - 2012-02-27 03:24 -0800
    Re: how to get arguments in a function split according to certain delimiters? Paul Branon <paulbranon@googlemail.com> - 2012-02-27 03:27 -0800
  Re: how to get arguments in a function split according to certain delimiters? "Chris F.A. Johnson" <cfajohnson@gmail.com> - 2012-02-27 15:37 -0500
    Re: how to get arguments in a function split according to certain delimiters? Selva <kobu.selva@gmail.com> - 2012-02-27 20:09 -0800
      Re: how to get arguments in a function split according to certain delimiters? Kaz Kylheku <kaz@kylheku.com> - 2012-02-28 05:44 +0000
        Re: how to get arguments in a function split according to certain delimiters? Martin Vaeth <vaeth@mathematik.uni-wuerzburg.de> - 2012-02-28 13:31 +0000

csiph-web