-
Hi, Fish version 3.3.1 In short, I want this to work: $ set fish_trace on
$ whiptail --notags --menu "Select a file" 20 80 10 (find -maxdepth 1 -type f -printf '"%f" "%f" ')
-> find -maxdepth 1 -type f -printf '"%f" "%f" '
> whiptail --notags --menu 'Select a file' 20 80 10 '"bla.pem" "bla.pem" '
Box options:
--msgbox <text> <height> <width>
--yesno <text> <height> <width>
--infobox <text> <height> <width>
... output removed for brevity ... As you can see, the How can I 'unquote' the output of the command? I've also tried setting the output of the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Fish only splits command substitutions on newlines That's the important information here. That's your problem.
It isn't. It's incorrect input for whiptail, but it's not "enclosed in single quotes". What Your argument here is as if you had used
(with a trailing space) What you need to figure out is what What whiptail expects is pairs of "tag" and "item". I.e. you would run this like whiptail --notags --menu 'Select a file' 20 80 10 "tag1" "item1" "tag2" "item2" And you're already trying this, both tag and item are supposed to be the filename. Only, you need to arrange for them to be separate arguments. As I've explained above, fish splits command substitution output into separate arguments on newlines - each line becomes a separate argument. It doesn't tokenize it, quotes have no meaning in the output (this is the same in bash - except that splits on spaces and tabs as well, which has issues for filenames with spaces). So you need to adjust Here: whiptail --notags --menu "Select a file" 20 80 10 (find -maxdepth 1 -type f -printf '%f\n%f\n') So
and this is turned into something like whiptail --notags --menu "Select a file" 20 80 10 bla.pem bla.pem secondfile secondfile thirdfile thirdfile which will make it happy. |
Beta Was this translation helpful? Give feedback.
-
You, my friend are a hero for giving such a detailed answer. Omitting the newline in the output was indeed the problem. I will be sure to read up a bit more on the substitution splitting. Thanks so much! |
Beta Was this translation helpful? Give feedback.
Fish only splits command substitutions on newlines
That's the important information here. That's your problem.
It isn't. It's incorrect input for whiptail, but it's not "enclosed in single quotes".
What
fish_trace
here is showing is the equivalent of the command that would be executed. It's a fictional commandline.Your argument here is as if you had used
'"bla.pem" "bla.pem" '
on the commandline. What is actually passed, what whiptail receives, is therefore one string:(with a trailing space)
What…