I trying to create a list of strings with spaces in, that I want to choose between in a
select
- something like this:
sel=""
while read l
do
sel=$(printf "%s '%s'" "$sel" "$l")
done< <(cd /some/data/directory;du -sh *)
select x in $sel
do
break
done
The string sel
looks like expected: "597G 2022" "49G analysis" "25K @Recycle"
, but the select looks like:
1) "597G 3) "49G 5) "25K
2) 2022" 4) analysis" 6) @Recycle"
#?
What I want to achieve is of course something like:
1) 597G 2022
2) 49G analysis
3) 25K @Recycle
#?
And more generally, something where you can select between strings built from several data sources in some way. I have looked for inspiration in several places, like here , but it doesn't quite work for my case.
***Edit***
I forgot to mention, this bash is rather old (and I can't update it, sadly):
[admin@CoMind-UniCron ~]# bash --version
GNU bash, version 3.2.57(1)-release (x86_64-QNAP-linux-gnu)
Copyright (C) 2007 Free Software Foundation, Inc.
Asked by j4nd3r53n
(779 rep)
Jan 6, 2023, 11:20 AM
Last activity: Jan 7, 2023, 12:05 PM
Last activity: Jan 7, 2023, 12:05 PM