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

Re: BASH : for sur liste de lignes et pas sur liste de mot



Quoting EISELE Pascal <lemmingsml@nerim.fr>:

> Bonjour,
> 
> J'aimerais faire un shell script utilisant la commande for. Mon probleme 
> c'est qu'elle prend en argument une liste de mot et j'aimerais qu'elle 
> prenne une liste de ligne !
> Exemple :
> for i in `mount`
> do
>     echo $i
> done
> Le pb c'est qu'il me découpe les lignes ! :/
> Quelqu'un à une idée ?
> 

Voir la variable $IFS dans le man de bash :

       IFS    The  Internal Field Separator that is used for word
              splitting after expansion and to split  lines  into
              words  with  the read builtin command.  The default
              value is ``<space><tab><newline>''.

    François.

-- 
Francois BOTTIN
--
    "How kind," the PFY sighs. "But where will I go?" 
    "Somewhere where they know nothing about computing...
where they wouldn't know a RAM chip from a potato chip!" 
    "But I don't want to visit Microsoft!" he whines.
              The BOFH 1998 - Simon Travaglia (bofh.ntk.net)



Reply to: