process-substitution Questions

3

I'm a C/C++ programmer and quite stupid in general (or at least the way bash does things it makes me feel confused). I can't wrap my head around process substitution. I need to define a global bo...
Inquisitor asked 26/1, 2012 at 1:16

6

Solved

If I run $#/bin/bash for i in `seq 5`; do exec 3> >(sed -e "s/^/$i: /"; echo "$i-") echo foo >&3 echo bar >&3 exec 3>&- done then the result is not synchronous; it...
Crackle asked 21/6, 2012 at 1:16

2

Solved

I came across an example for the using tee utility in the tee info page: wget -O - http://example.com/dvd.iso | tee >(sha1sum > dvd.sha1) > dvd.iso I looked up the >(...) syntax and ...
Footy asked 11/7, 2018 at 20:32

1

Solved

Many Ansible modules are designed to accept file paths as a parameter, the but lack the possibility to supply the contents of the file directly. In cases where the input data actually comes from so...
Goatskin asked 7/1, 2022 at 17:22

1

What is the <( ) syntax in shell / bash, and how do I search for it (meaning: what's it called)? Is this related to the "heredoc" syntax? Example: Pass a password to ssh in pure ...
Sidwell asked 9/11, 2021 at 0:2

2

As far as I know, process substitution <(...) / >(...) creates the fd and stores the output of commands in parentheses into the generated fd. Therefore, these two commands are equivalent $ l...
Spring asked 10/10, 2017 at 6:34

5

Solved

How can I figure out if a file descriptor is currently in use in Bash? For example, if I have a script that reads, writes, and closes fd 3, e.g. exec 3< <(some command here) ... cat &l...
Theater asked 12/1, 2017 at 1:42

2

Solved

I have a program that reads from two input files simultaneously. I'd like to have this program read from standard input. I thought I'd use something like this: $program1 <(cat) <($program2) ...
Buddhism asked 17/3, 2017 at 5:35

5

Solved

I have a bash script which calls several long-running processes. I want to capture the output of those calls into variables for processing reasons. However, because these are long running processes...
Versify asked 16/9, 2012 at 22:30

1

Solved

I often run the command squeue -u $USER | tee >(wc -l) where squeue is a Slurm command to see how many jobs you are running. This gives me both the output from squeue and automatically tells ...
Girlish asked 9/5, 2018 at 21:47

1

Solved

When I issued two equivalent commands in Bash I got different output (from "wc -l" command), see below: root@devel:~# ls /usr/bin -lha | tee >(wc -l) >(head) > /dev/null total 76M drwxr-x...
Uterine asked 12/11, 2017 at 19:49

4

Solved

The following script calls another program reading its output in a while loop (see Bash - How to pipe input to while loop and preserve variables after loop ends): while read -r col0 col1; do # [....
Bag asked 2/5, 2017 at 10:48

1

Solved

After reading explanations of how the exec builtin works in bash, I understand that its basic function is to replace the current process without forking. It also seems to be used for redirecting I/...
Bynum asked 12/1, 2017 at 0:19

1

Solved

<(commands ...) in bash/zsh makes the output behavior as a file. Does a POSIX equivalent exist?
Motorcade asked 5/8, 2016 at 19:6

3

Solved

(Possibly related to Do some programs not accept process substitution for input files?) In some Bash unit test scripts I'm using the following trick to log and display stdout and stderr of a comma...
Cherish asked 20/12, 2010 at 11:22

1

Solved

I've the following shell script: cat <(echo foo) source <(echo bar=bar) echo $bar However it works differently in GNU bash 3.2 and 4.3 as shown below: $ /bin/bash foo.sh foo 3.2.53(1)-r...
Accusal asked 15/9, 2015 at 21:39

4

Solved

I have this shell script which I use to back up my system. There is a line: tar -Pzcpf /backups/backup.tar.gz --directory=/ --exclude=proc --exclude=sys --exclude=dev/pts --exclude=backups --exclu...
Gentleman asked 25/8, 2012 at 8:57

3

Solved

For this question I will use grep, because its usage text prints to stderr: $ grep Usage: grep [OPTION]... PATTERN [FILE]... Try `grep --help' for more information. You can capture stdout easily w...
Constitutional asked 13/3, 2013 at 17:42

2

Solved

I have the following code: #!/bin/bash read -t1 < <(stat -t "/my/mountpoint") if [ $? -eq 1 ]; then echo NFS mount stale. Removing... umount -f -l /my/mountpoint fi How do I mute the o...
Seavey asked 19/7, 2013 at 16:56

4

Solved

I am trying to understand the differences between these two similar commands. aa=$(foo | bar | head -1) read aa < <(foo | bar | head -1) I know that <() requires #!/bin/bash, but does ...
Winchell asked 14/3, 2013 at 17:47

2

Solved

I'm trying to use process substitution for an input file to a program, and it isn't working. Is it because some programs don't allow process substitution for input files? The following doesn't wor...
Fivepenny asked 25/11, 2010 at 6:2
1

© 2022 - 2025 — McMap. All rights reserved.