I'm tried to parameretrize in a variable the file descriptor number to open a tcp socket using exec command but it failed. Only work correctly when file descriptor number is a constant.
Cygwin bash script was invoked in bash shell as follows:
Code:
/cygdrive/c/cygwin/bin/bash test.sh
This is content of my script
Code:
#!/bin/bash
#
exec 3</cygdrive/c/cygwin/home/work/part1.txt
read -u 3 x
echo $x
exec 3<&-
Commands work correctly when issued one at a time within bash shell.
But when I attempt to run the shell script I get
I am creating a script to produce some .tex files with a lot of lines (a kind of automatic sample).
I've inherited a script that does this in a function:
# IO redirection for logging.
#touch $LOGFILE
exec 6>&1 # Link file descriptor #6 with stdout.
# Saves stdout.
exec > $LOGFILE # stdout replaced with file $LOGFILE.
touch $LOGERR
exec 7>&2 # Link file descriptor #7 with stderr.
# Saves stderr.
exec 2> $LOGERR # st
First post here, so hopefully all guidelines are followed, and thanks in advance for any replies.
I'm working on a shell script(BASH) that processes a csv file and performs various tasks with the data. All is well, except I want to use 'tee' to send output from 'wc' to a file as well as pipe it to 'cut'.
After some manipulations, I got the file with commands that I would be glad to be able to execute.
Input file (name of file is inp2.txt):
"02 - Beautiful Emptiness.mp3"
"02 - Come.
Assume the OS is linux. Suppose I opened a file for write and get a file descriptor fdw. Is it possible to get another file descriptor fdr, with read-only access to the file without calling open again?
Within PyGTK I'm using gobject.spawn_async to launch a bash script. I would like the output of that bash script to be displayed within my application. I have a textview set up to receive the text ... but I don't know how to do it.
Here are the commands that launch the program:
Code:
def run_command(command):
global keep_pulsing
Hey guys,
I know that title is a mouthful - I'll try to better explain my struggles a little better...
What I'm trying to do is:
1. Query a db and output to a file, a list of column data.
2.