bug-bash
[Top][All Lists]
Advanced

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

Re: how to pass arguments with space inside?


From: Mike Frysinger
Subject: Re: how to pass arguments with space inside?
Date: Thu, 9 Apr 2009 17:34:56 -0400
User-agent: KMail/1.11.1 (Linux/2.6.28; KDE/4.2.1; x86_64; ; )

On Thursday 09 April 2009 16:46:27 lehe wrote:
> I was wondering how to pass arguments with space inside. For example, my
> bash script looks like:
>
> #!/bin/bash
> ARG_OPTS=""
> while [[ -n "$1" ]];
>         ARG_OPTS="${ARG_OPTS} $1"
>       shift
> done
>
> If I pass an argument like "--options='-t 0 -v 0'", then it would be
> splitted by the spaces inside, ie "--options='-t", "0", "-v" and "0".
>
> How can I achieve what I wish?

use arrays

$ f=( a "b c" d)
$ printf '%s\n' "address@hidden"
a
b c
d
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

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