Can process substitution be used as an input file to another program?
Hey, I was trying to figure out how to launch a program from the command line, and it works if you pass it a config file. I was thinking about writing a script to dynamically create the config file and pass it to the command using something like command substitution (so I don't actually have to create a file).
I'm using Bash 3.2.39
Well I went and tried the following just to see if it would work:
But it just said that it can't find the file /dev/fd/63.
Well
does work (dumps it to the screen), so I thought maybe the file descriptor was being closed before the commad could use it.
So I tried making a more persistent one:
But it just says that it cannot find /dev/fd/10, even though it is there, and i can
just fine (albeit just once).
Shouldn't this be possible? Or does the program have to do something special to be compatable with named pipes?
I'm not super-knowledgable about bash, but I've read as much as I can find on the subject. Any insight is appreciated!
Um, I won't get into the technicalities of why you tried didn't work -- it's a bit complicated. Normally you want to send input from a file like this:
You can do this with named pipes:
You have to put the cat into the background, because the pipe doesn't buffer any input.
i have tried process substitution, but run in some problems.
this works:
samtools view -h $SAMdir/$b.bam | htseq-count -m union -s no -q -t exon -i gene_id - $gtf > $b.count &
but this not:
htseq-count -m union -s no -q -t exon -i gene_id <(samtools view -h $SAMdir/$b.bam) $gtf >... (7 Replies)
Hi Friends,
I am running a program
/path/to/program -i 1 100 -o /path/to/output/op_1_100.txt
In the above command, I have to try various number of combinations at the -i parameter and the output file name varies with each combination.
Now, I have my -i parameter text file, which is like... (4 Replies)
Hello to all. I'm new to this forum, so please go easy on me. =)
I am working on a script to send two e-mail attachments in a single e-mail, and am running into a little bit of an issue when using process substitution. I am using the following:
cat <(uuencode $1 <(basename $1)) <(uuencode... (5 Replies)
Output file template format
<input_file_name>a</input_file_name>
<total_length_size>b</total_length_size>
<log_10_length_size>c</log_10_length_size>
Input_file_1 (eg. sample.txt)
SDFSDGDGSFGRTREREYWW
Parameter:
a is equal to the input file name
b is equal to the total length of... (2 Replies)
Hi,
I want to know if there's a cleaner way for assigning output of a unix command to a variable in C program .
Example : I execute dirname fname and want the output to be assigned to a variable dname . Is it possible .
I knew u can redirect the output to a file and then reread assigning... (5 Replies)
By "many many times" I mean the times the input file is to be processed is unknown beforehand, it will be known when awk finishes processing the input file for the first time.
So my question is: how to start over again from the first record of the input file when AWK finishes processing the... (7 Replies)
Hi
I have a script to run some other scripts automatically. But while running the script it should take the input value from a text file instead of taking from the keyboard. Please find last two lines of the script below. Here ans should be taken from a text file ineerly without displaying this... (1 Reply)
Just playing around with process substitution.
Hoping maybe someone can give me some help on what I'm doing wrong.
When this script is run, "Null message body; hope that's ok" is returned and the script hangs.
I can't seem to work out what I'm doing wrong.
Here is the script:
#!/bin/bash... (3 Replies)
i have a program ABC, which runs every two minutes and takes the input according to the a value called "pointer"
files need to be processed by ABC are
input0001
input0002
input0003
input0004
input0005
current value of pointer is 0001, now program runs and takes all the files from... (2 Replies)
Hello
I am getting error when the file (Folder or Application) path having space is given as external input to the shell program.
It works fine for the files which has no spaces in the file name
Thans, (5 Replies)