[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] set and IFS
From: |
Gérard ROBIN |
Subject: |
Re: [Help-bash] set and IFS |
Date: |
Tue, 20 Nov 2018 13:35:19 +0100 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
On Tue, Nov 20, 2018 at 01:26:33PM +0200, Pierre Gaston wrote:
> Date: Tue, 20 Nov 2018 13:26:33 +0200
> From: Pierre Gaston <address@hidden>
> To: address@hidden
> Cc: address@hidden
> Subject: Re: [Help-bash] set and IFS
>
> IFS is working fine the problem is that the * gets expanded because your
> variables are not quoted.
> ( var=*; echo $var)
>
> Some of the possible fix include:
> * read the fields directly: while IFS=: read one two three four rest;do
> echo "$one" "$four" ;done
> * disable globbing with set -f/set +f
> * parse again the line with read
> * parse manually with parameter expansion eg ${var##:*}
Thank you so much.
--
Gerard