Groups | Search | Server Info | Login | Register


Groups > fr.comp.os.unix > #8120

Re: [bash] select

From Jo Engo <yl@icite.fr>
Newsgroups fr.comp.os.unix
Subject Re: [bash] select
Date 2023-12-09 21:15 +0000
Organization <http://pasdenom.info/news.html>
Message-ID <ul2ld2$d5$4@rasp.pasdenom.info> (permalink)
References <ul1sek$d5$2@rasp.pasdenom.info>

Show all headers | View raw


Le Sat, 9 Dec 2023 14:09:24 -0000 (UTC), Jo Engo a écrit :

> <code>
> select toto in $(sed "s/^/\"/;s/$/\"/" menu); do  echo $toto; done </>

Bon ça, donc, ça ne marche pas. J'ai trouvé un « solution » que je ne 
trouve pas du tout élégante mais qui « marche » :
(pour tester)

#!/bin/bash
read -p "fichier de menu : "
# attention, il y a bien un saut de ligne entre les quotes
 IFS='
' select item in $(cat $filee)
do 
	echo $item
# faire des trucs	
done
# fin script

Quelqu'un a quelque chose de mieux à me proposer ?





-- 
Si l'électron nous a servi à comprendre beaucoup de choses,
nous n'avons jamais bien compris l'électron lui-même.
	-+- Louis de Broglie -+-

Back to fr.comp.os.unix | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

[bash] select Jo Engo <yl@icite.fr> - 2023-12-09 14:09 +0000
  Re: [bash] select Jo Engo <yl@icite.fr> - 2023-12-09 21:15 +0000
    Re: [bash] select Jo Engo <yl@icite.fr> - 2023-12-09 21:59 +0000
    Re: [bash] select Jo Engo <yl@icite.fr> - 2023-12-10 16:52 +0000
      Re: [bash] select Christian Weisgerber <naddy@mips.inka.de> - 2023-12-11 18:34 +0000
        Re: [bash] select Jo Engo <yl@icite.fr> - 2023-12-13 14:38 +0000
          Re: [bash] select Christian Weisgerber <naddy@mips.inka.de> - 2023-12-13 23:00 +0000
        Re: [bash] select Jo Engo <yl@icite.fr> - 2023-12-14 15:21 +0000
          Re: [bash] select Jo Engo <yl@icite.fr> - 2023-12-14 15:43 +0000
          Re: [bash] select Christophe PEREZ <chris@novazur.fr> - 2023-12-14 18:51 +0000
          Re: [bash] select Christian Weisgerber <naddy@mips.inka.de> - 2023-12-14 18:38 +0000
  Re: [bash] select Christian Weisgerber <naddy@mips.inka.de> - 2023-12-11 18:32 +0000

csiph-web