bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to supply a string with space in it as parameter to a function?


From: Andres P
Subject: Re: How to supply a string with space in it as parameter to a function?
Date: Wed, 23 Jun 2010 18:20:10 -0430

On Wed, Jun 23, 2010 at 6:07 PM, Peng Yu <pengyu.ut@gmail.com> wrote:
> #!/usr/bin/env bash
>
> function f {
> #for i in $*;
> for i in $@;
> do
>  echo $i
> done
> }
>

You can also omit the variable intirely:
        for i; do
                echo "$i"
        done

In that case, the for loop will iterate over "$@".

Andres P



reply via email to

[Prev in Thread] Current Thread [Next in Thread]