Sponsored Content
Top Forums Shell Programming and Scripting Can process substitution be used as an input file to another program? Post 302327896 by bj0 on Monday 22nd of June 2009 10:14:38 PM
Old 06-22-2009
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:
Code:
command --config <(cat ./configfile)

But it just said that it can't find the file /dev/fd/63.

Well
Code:
cat <(cat ./configfile)

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:
Code:
exec 10< <(cat ./configfile)
command --config /dev/fd/10

But it just says that it cannot find /dev/fd/10, even though it is there, and i can
Code:
cat /dev/fd/10

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!

Thanks.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File path with space as external input to the program

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)
Discussion started by: keshav.murthy@r
5 Replies

2. Shell Programming and Scripting

How to run this program with only one input file at a time

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)
Discussion started by: Prat007
2 Replies

3. Shell Programming and Scripting

Process substitution

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)
Discussion started by: mandelbrot333
3 Replies

4. Shell Programming and Scripting

How to read the input from a file in background process?

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)
Discussion started by: shirdi
1 Replies

5. Shell Programming and Scripting

How to make AWK process an input file many many times?

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)
Discussion started by: kevintse
7 Replies

6. UNIX for Advanced & Expert Users

Help with command substitution in C program

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)
Discussion started by: royalbull
5 Replies

7. Shell Programming and Scripting

Help to write a script or program to automatic execute and link input file data

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)
Discussion started by: perl_beginner
2 Replies

8. UNIX for Dummies Questions & Answers

Process Substitution Question?

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)
Discussion started by: rommager
5 Replies

9. Shell Programming and Scripting

How to give a text file as input while running a program?

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)
Discussion started by: jacobs.smith
4 Replies

10. Shell Programming and Scripting

Problem with process substitution

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)
Discussion started by: dietmar13
7 Replies
asadmin-create-resource-adapter-config(1AS)			   User Commands		       asadmin-create-resource-adapter-config(1AS)

NAME
asadmin-create-resource-adapter-config, create-resource-adapter-config - creates the configuration information in domain.xml for the connector module SYNOPSIS
create-resource-adapter-config --user admin_user [--password admin_password] [--host localhost] [--port 4848] [--secure|-s] [--passwordfile filename] [--terse=false] [--echo=false] [--interactive=true] [--threadpools threadpoolids] [--property name=value[:name=value]*] raname Creates configuration information for the connector module. This command can be executed prior to deploying a resource adapter, so that the configuration information is available at the time of deployment, or after deployment. If the resource adapter is created after deployment, the resource adapter is started. You must first create a threadpool, using the create-threadpool command, and then identify that threadpool value as the ID in the--threadpools option. This command is supported in remote mode only. OPTIONS
--user authorized domain application server administrative username. --password password to administer the domain application server. --host machine name where the domain application server is running. --port port number of the domain application server listening for administration requests. --secure if true, uses SSL/TLS to communicate with the domain application server. --passwordfile file containing the domain application server password. --terse indicates that any output data must be very concise, typically avoiding human-friendly sentences and favoring well- formatted data for consumption by a script. Default is false. --echo setting to true will echo the command line statement on the standard output. Default is false. --interactive if set to true (default), only the required password options are prompted. --threadpool the threadpool ID from which the work manager gets the thread. --property configuration properties of the resource adapter java bean. OPERANDS
raname the value kept in the resource-adapter-name in the domain.xml file. Example 1: Using create-resource-adapter-config asadmin> create-resource-adapter-config --username admin1 --password adminadmin myresourceadapter Command create-resource-adapter-config executed successfully EXIT STATUS
0 command executed successfully 1 error in executing the command asadmin-create-threadpool(1AS), asadmin-delete-resource-adapter-config(1AS), asadmin-list-resource-adapter-configs(1AS) J2EE 1.4 SDK March 2004 asadmin-create-resource-adapter-config(1AS)
All times are GMT -4. The time now is 06:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy