Help on passing an input variable to the voronota program (after third pipe)
Dear UNIX forum members,
I am using macbook pro 13 (2015 edition) with MAC OS Mojave and am trying to write the shell script where when it is run through terminal it asks for an input (in the code below an input variable is domains) and then that input becomes capital letter or letters which voronota program requires (so instead of 'c<domains>' it should be 'c<C,D>' or any other letter combinations when the voronota program is run at the third pipe). The code is given below :
I am expecting to get 1.18715 after awk prints the value to the terminal, but in the above code I do not get any value which signals to me that when I write C,D after shell asks "Domains: " the written input is not passed to the variable domain at:
I will look forward to your help.
Sincerely,
Aurimas
P.S. I tried writing "$domains" but still no success
EDIT: Nevermind, called a friend who is good at this stuff and he figured it out :D
Hi all,
So I'm trying to teach myself to write programs for unix in c. I am currently creating a program, and I need to pass a struct through a pipe, but I can't figure out how.
The struct I want to pass... (0 Replies)
Hello,
I recently upgraded our server from Solaris 8 to 9. The sendmail is unabled to pipe the email to a perl script. I can send and received email to local and external mail, but the script did not get the email. There is no error in the log and I could not find any thing on the web.
Here... (0 Replies)
I have an Shell script which has few global variables
eg :
range=100;
echo "$range"
I want to use the same variable in my C++ program for example
int main()
{ cout << range << "\n"; }
i tried using this
int main(int argc, char *argv)
{ cout << range << "\n"; }
but... (5 Replies)
Hello guys,
my professor give me 2 days to study and make a program usign pipe, fork in c
i need to do a program
read a arq.txt
the father process read the file and the child print !
like this
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
int main (){
... (1 Reply)
Hello guys,
my professor give me 2 days to study and make a program usign pipe, fork in c
i need to do a program
read a arq.txt
the father process read the file and the child print !
2. Relevant commands, code, scripts, algorithms:
like this
Code:
#include <stdio.h>... (1 Reply)
Hi all,
I would like to use properly an input pipe, like this :
cat myFile.txt | myCommand.shI always find this solution :
while read line; do ...; donebut I have a great lost of performance !
On a big file, with a simple grep, I can spend 2400 times more time ! oO
(from 0,023sec to 1m)... (4 Replies)
Hi,
I would like to compare 2 files using awk, which I can do by using:
awk 'NR==FNR{a;next} (NR > 32 && $2 in a) {print $0}' File1 and File2.
If the name of the File1 is in another file (for example, column 4 in File 3) then how can I pass this column 4 to the awk command.
Thanks in... (1 Reply)
I have a shell program that calls another shell program
the following code works
. chkTimeFormat.sh "10/9/12 17:51:19:783."|read c
but when I am passing the the time in a variable like in the code below, the shell chkTimeFormat.sh is not returning proper value
time="10/9/12... (9 Replies)
I have a below syntax its working fine...
var12=$(ps -ef | grep apache | awk '{print $2,$4}')
Im getting expected output as below:
printf "%b\n" "${VAR12}"
dell 123
dell 456
dell 457
Now I wrote a while loop.. the output of VAR12 should be passed as input parameters to while loop and results... (5 Replies)
Hello,
I have an ffmpeg bash script which is working nice and
I need to do the same for other sources.
To create new scripts and to deal with multiple bash files sounds not logical. It is a bit hard to manage for me..
I wondered if it was possible to make my input file as variable.
Then I... (1 Reply)
Discussion started by: baris35
1 Replies
LEARN ABOUT NETBSD
pipe
PIPE(2) BSD System Calls Manual PIPE(2)NAME
pipe -- create descriptor pair for interprocess communication
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <unistd.h>
int
pipe(int fildes[2]);
int
pipe2(int fildes[2], int flags);
DESCRIPTION
The pipe() function creates a pipe, which is an object allowing unidirectional data flow, and allocates a pair of file descriptors. The
first descriptor connects to the read end of the pipe, and the second connects to the write end, so that data written to fildes[1] appears on
(i.e., can be read from) fildes[0]. This allows the output of one program to be sent to another program: the source's standard output is set
up to be the write end of the pipe, and the sink's standard input is set up to be the read end of the pipe. The pipe itself persists until
all its associated descriptors are closed.
A pipe whose read or write end has been closed is considered widowed. Writing on such a pipe causes the writing process to receive a SIGPIPE
signal. Widowing a pipe is the only way to deliver end-of-file to a reader: after the reader consumes any buffered data, reading a widowed
pipe returns a zero count.
The pipe2() function behaves exactly like pipe() only it allows extra flags to be set on the returned file descriptor. The following flags
are valid:
O_CLOEXEC Set the ``close-on-exec'' property.
O_NONBLOCK Sets non-blocking I/O.
O_NOSIGPIPE
Return EPIPE instead of raising SIGPIPE.
RETURN VALUES
On successful creation of the pipe, zero is returned. Otherwise, a value of -1 is returned and the variable errno set to indicate the error.
ERRORS
The pipe() and pipe2() calls will fail if:
[EFAULT] The fildes buffer is in an invalid area of the process's address space. The reliable detection of this error cannot be
guaranteed; when not detected, a signal may be delivered to the process, indicating an address violation.
[EMFILE] Too many descriptors are active.
[ENFILE] The system file table is full.
pipe2() will also fail if:
[EINVAL] flags is other than O_NONBLOCK or O_CLOEXEC.
SEE ALSO sh(1), fork(2), read(2), socketpair(2), write(2)STANDARDS
The pipe() function conforms to ISO/IEC 9945-1:1990 (``POSIX.1'').
HISTORY
A pipe() function call appeared in Version 6 AT&T UNIX. The pipe2() function is inspired from Linux and appeared in NetBSD 6.0.
BSD January 23, 2012 BSD