Skip to main content

Questions tagged [read]

`read` is a shell utility used for reading strings from the standard input stream, or from a file descriptor.

0 votes
2 answers
80 views

I'm writing a shell script that's aimed to be as portable and POSIX-compatible as possible, so usage of bash-only commands or high-level input libraries is undesirable. I'm looking for a way to read a ...
carbon-starlight's user avatar
2 votes
1 answer
96 views

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 ...
luna's user avatar
  • 25
5 votes
1 answer
364 views

In bash, the following command printf 'foo bar\n' | { read a b; printf '<%s> <%s>\n' $a $b; } produces the output <foo> <bar> In fish, the following command printf 'foo ...
enzotib's user avatar
  • 53.6k
0 votes
1 answer
212 views

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 ...
user153064's user avatar
0 votes
2 answers
234 views

If I open a fifo for reading+writing in blocking mode: fd = open("foo", "O_RDWR"); Then it blocks until someone on the other end opens it for either reading or writing. But how do ...
Ariel's user avatar
  • 117
0 votes
1 answer
220 views

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 > ...
Joseph Camacho's user avatar
1 vote
1 answer
91 views

I open two terminal windows. In one, I run: $ read foo I don't press RETURN, so read is blocking. In the other terminal window, I search for the process: $ ps -ef | grep foo user 95292 94814 ...
Ruben P. Grady's user avatar
1 vote
1 answer
146 views

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 $...
ychaouche's user avatar
  • 1,043
0 votes
0 answers
86 views

I have a file named "test.log" with contents: 2 root 20 0 0 0 0 S 0.0 0.0 0:00.01 [kthreadd] Then I use while-read command to process it: cat test.log |...
傅继晗's user avatar
  • 101
-2 votes
1 answer
1k views

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 ...
user447274's user avatar
-2 votes
1 answer
174 views

I want to grep an IP address inside Nginx configuration files. I want to input the IP address with the read command, but I don't want to store input in an additional variable. So I want something like:...
palmasd1's user avatar
  • 127
0 votes
1 answer
289 views

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 ...
ranjit abraham's user avatar
1 vote
2 answers
2k views

I have a bash script like this: #!/bin/bash while read -r -a line do ... parse $line in some way done This script is executed by piping the command from another program: some-random-program | ...
lord_nimon's user avatar
0 votes
1 answer
168 views

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 '*...
Porcupine's user avatar
  • 2,196
0 votes
1 answer
72 views

I have a script that joins together various lists of data fields which then needs to have a few more columns added. The file generated looks like this: $ cat compiled.csv "name":"...
vxla's user avatar
  • 11

15 30 50 per page
1
2 3 4 5
26