Questions tagged [read]
`read` is a shell utility used for reading strings from the standard input stream, or from a file descriptor.
374 questions
2 votes
1 answer
67 views
Make `set -o vi` vim cursor reflect editing mode when in `read`
I have a script read.sh: read -ei "hello world" eval $REPLY Upon executing chmod +x read.sh and then running ./read.sh, I notice that pressing Esc followed by b or w jumps between the ...
0 votes
1 answer
140 views
Need Help Understanding script that reads output of cursor position ANSI escape code
I have this code, which does what I want, but I don't entirely understand it: #!/usr/bin/env bash echo -ne "\033[6n" # Ask the terminal to print out the cursor's position ...
0 votes
1 answer
145 views
How can I make writes to named pipe block if the reader closes, and vice versa?
Right now if I write to a name pipe and then close the reader, the writer gets a SIGPIPE and then exits. For example, $ mkfifo pipe $ cat pipe & # read from the pipe in the background $ cat > ...
1 vote
1 answer
116 views
rm prompt not working when invoked from a piped loop
I am trying to remove files from a directory by pasting their names into a while loop that will simply rm each item from the list of files given to it. $ sponge | while read file; do echo "rm $...
-2 votes
1 answer
807 views
Linux Bash Script - Yes or No - read answer
little script #!/bin/sh cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 24 | head -n 4 printf 'do you like this? (y/n)? ' read answer if [ "$answer" != "${answer#[Yy]}" ] ;then ...
0 votes
1 answer
240 views
Add a numerical value to a variable while reading a file in bash in loop [duplicate]
I have a file with the following values. I am trying to read from the file and add 1096 to the last value and generate the output on screen. My original file looks like this. agile_prod_toolkit,30 ...
0 votes
1 answer
137 views
Find - xargs, for every line open a new shell and execute a command and wait for user to exit that shell
Following works Task: List all folders that contain file of iname *AlbumArt* that also contain iname *cover*.jpg, and for each of those folder list all jpg files with size find . -type f -iname '*...
1 vote
1 answer
481 views
Unable to read more than 1024 chars on ZSH + MacOS
Trying to read a long input into a variable from ZSH on MacOS. echo "URL: " read URL input is always truncated to 1024 chars... if I try and type additional chars nothing happens. ...