Deutsch   English   Français   Italiano  
<slrnunkdrj.ga0.naddy@lorvorc.mips.inka.de>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!2.eu.feeder.erje.net!feeder.erje.net!weretis.net!feeder8.news.weretis.net!news.szaf.org!inka.de!mips.inka.de!.POSTED.localhost!not-for-mail
From: Christian Weisgerber <naddy@mips.inka.de>
Newsgroups: fr.comp.os.unix
Subject: Re: [bash] select
Date: Wed, 13 Dec 2023 23:00:03 -0000 (UTC)
Message-ID: <slrnunkdrj.ga0.naddy@lorvorc.mips.inka.de>
References: <ul1sek$d5$2@rasp.pasdenom.info>
 <ul2ld2$d5$4@rasp.pasdenom.info> <ul4qc3$d5$8@rasp.pasdenom.info>
 <slrnunelhu.269.naddy@lorvorc.mips.inka.de>
 <ulcflr$n90$1@rasp.pasdenom.info>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 13 Dec 2023 23:00:03 -0000 (UTC)
Injection-Info: lorvorc.mips.inka.de; posting-host="localhost:::1";
	logging-data="16705"; mail-complaints-to="usenet@mips.inka.de"
User-Agent: slrn/1.0.3 (FreeBSD)
Bytes: 1552
Lines: 26

On 2023-12-13, Jo Engo <yl@icite.fr> wrote:
>
>> Dans bash:
>> IFS=$'\n'
>
> C'est noté, mais on me demande expressément de ne pas utilise IFS. Comment 
> puis-je faire, une idée ?

Avec un tableau. On pourrait remplir le tableau avec une boucle :

    i=0
    while read -r tableau[i]; do
            ((i++))
    done <$filee

Ou plus court avec mapfile :

    #!/usr/local/bin/bash
    read -p "fichier de menu : " filee
    mapfile -t tableau <$filee
    select item in "${tableau[@]}"
    do
            echo $item
    done

-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de