Questions tagged [select]
`select` is a keyword in the syntax of the Korn shell language (and other Korn-like shells such as `zsh` or `bash`) used to create menus for terminal user interaction. For creating TUI-based menus and other dialogs in shell scripts, see `whiptail`/`dialog` or `zenity` for GUI ones.
35 questions
0 votes
1 answer
188 views
Why does a Bash script with select exit without input when reading from stdin?
I'm working on a Bash script that optionally accepts input from stdin and then presents the user with a selection menu using select. The issue arises when the script is provided data via stdin—the ...
3 votes
4 answers
3k views
How do I select an array to loop through from an array of arrays?
#!/usr/bin/bash ARGENT=("Nous devons économiser de l'argent." "Je dois économiser de l'argent.") BIENETRE=("Comment vas-tu?" "Tout va bien ?") aoarrs=("${...
0 votes
1 answer
47 views
how to write a commant for output of a particular group?
Reading file prod1.tpr, VERSION 2019.6 (single precision) Reading file prod1.tpr, VERSION 2019.6 (single precision) Select a group of reference atoms and a group of molecules to be ordered: Group ...
0 votes
2 answers
435 views
when read buffer size is 2048, it work , but buffer size is 48 or other number, write call will be blocked, why?
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/select.h> #include <fcntl.h> #include <unistd.h> int main(int argc, char* argv[]){ if(...
2 votes
2 answers
938 views
select from a constructed list of strings with whitespace?
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&...
1 vote
1 answer
80 views
Selecting from various media using awk shell script
I have made a simple backup program for my bin folder. It works. Code and resultant STDOUT below. Using rsync to copy from local ~/bin folder to a /media/username/code/bin folder. The code works fine ...
0 votes
1 answer
852 views
Why plus 1 is needed in select system call?
From man select : int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); nfds should be set to the highest-numbered file descriptor in any of ...
2 votes
1 answer
10k views
Getting the first/last/nth result from a jq select result
I am trying to find a way to pipe the result of my current script into another command which will leave me with just the last result of the array I get in my select here: jq -r --arg name "$1&...
0 votes
2 answers
243 views
Select command showing options without question
Select command is showing options without displaying question. It is displaying question after a choice is made. I have a function as shown below in a script. function start_AppNode { # Define ...
3 votes
2 answers
11k views
How to select a word under cursor?
For all text editor or application I'm using, I want to select a word under cursor using keyboard shortcut. How can I do it? I tried look around I didn't find anything helpful.
0 votes
1 answer
2k views
Bash script selecting folder
I am trying to list all the directory latest modified folder first using select, but I am stuck. Let's say I have: Folder1 ThisIsAnotherDir Directory New Directory This IS not_Same Directory When I ...
3 votes
2 answers
3k views
select would indicate pipe is readable when there's no data in pipe and write end is closed?
I am reading The Linux Programming Interface. From 63.2.3 When Is a File Descriptor Ready?, it says: Correctly using select() and poll() requires an understanding of the conditions under which a ...
0 votes
0 answers
393 views
Xed : highlight selected text occurences?
I'm using Gnome Xed text editor. Is there a way to auto select all occurrences of currently selected-text across the document. If Xed cant do it, what other linux text editor can do it ? How ?
2 votes
1 answer
616 views
How to display different directory content with Bash select command?
So far I have found some examples of Bash select function usage with logical constructed options or Asterisk one (i.e select s in *). This last one lists all actual directory content. So I would like ...
0 votes
1 answer
53 views
How to use select to choose from x files, that contain lists, needed to run set of commands against, in this case curl
I have about 100 lists of URLs used for health checking (200, 300,400,500) but cannot figure out the terminology to ask the question. In advance, I apologize. I want to use a list to choose on of ...