Hi everybody, first of all i am a new member in UNIX.com and this is my first post.
I am impressed with the amount of information a person can ever have in this forum, it is really great having something similiar; anyways let me tell you about the problem I am having, hope you will answer me.... (6 Replies)
Hi,
in my script I need to execute the following command:
query $id 456 432
but it waits for a RETURN character from keyboard and therefore, it fails. I tried something like:
query $id 456 432 << '\n'
but, i'ts clear it is not correct. Is there any way to do this?
Thxs. (0 Replies)
while running a user inter-active program
how can we get the commands from a
file instead of the user?
is there anyway to permanently redirect content
of a file to standard input? (6 Replies)
Hello,
I need to change user and run some commands by using a script.
lets say, I'm using
su - someuser << start
password required -----> how can I enter the password here
command 1
command 2
command 3
command 4
start
While trying to run this I got the following message:
"standard... (2 Replies)
Hello,
I need help with a bash script that I try to improve. I could not find answer so far, maybe because I'm not to familiar with the terminology so feel free to correct my language.
I have a script that looks like:
NODES="node_a node_b node_c"
for NODE in $NODES
do
... (4 Replies)
All,
I have a requirement to write a script where I check for Input redirection when the script was executed, based on which I handle my logic. Below is the example:
my.script
#! /bin/ksh
# Not sure how to frame the if condition below
if ; then
echo "Input Redirected from a file"
... (7 Replies)
Hello everyone,
My requirement is that within a script I need to construct the command line exactly that it was invoked with. For example :
sh a.sh arg1 arg2 arg3 < input.txt > output.txt
Now within a.sh, I construct a file which has these contents "
sh a.sh arg1 arg2 arg3 < input.txt >... (8 Replies)
Can someone please explain when input redirection is necessary?
For example, "cat filename" and "cat< filename" produce the same result. I was told that if I need to bunzip a file that I should type "bunzip2<filename.bz2." However, if I omit the "<" I still get the same result. Can someone... (4 Replies)
Hi,
when I try to redirect input and the command is described as a string within an array redirection does not work. why?
#!/bin/bash
dir=("tail < ./hello.txt")
tail < ./hello.txt #works
${dir} #does not work (2 Replies)
Discussion started by: heinzel
2 Replies
LEARN ABOUT BSD
pipe
PIPE(2) System Calls Manual PIPE(2)NAME
pipe - create an interprocess communication channel
SYNOPSIS
pipe(fildes)
int fildes[2];
DESCRIPTION
The pipe system call creates an I/O mechanism called a pipe. The file descriptors returned can be used in read and write operations. When
the pipe is written using the descriptor fildes[1] up to 4096 bytes of data are buffered before the writing process is suspended. A read
using the descriptor fildes[0] will pick up the data.
It is assumed that after the pipe has been set up, two (or more) cooperating processes (created by subsequent fork calls) will pass data
through the pipe with read and write calls.
The shell has a syntax to set up a linear array of processes connected by pipes.
Read calls on an empty pipe (no buffered data) with only one end (all write file descriptors closed) returns an end-of-file.
Pipes are really a special case of the socketpair(2) call and, in fact, are implemented as such in the system.
A signal is generated if a write on a pipe with only one end is attempted.
RETURN VALUE
The function value zero is returned if the pipe was created; -1 if an error occurred.
ERRORS
The pipe call will fail if:
[EMFILE] Too many descriptors are active.
[ENFILE] The system file table is full.
[EFAULT] The fildes buffer is in an invalid area of the process's address space.
SEE ALSO sh(1), read(2), write(2), fork(2), socketpair(2)BUGS
Should more than 4096 bytes be necessary in any pipe among a loop of processes, deadlock will occur.
4th Berkeley Distribution August 26, 1985 PIPE(2)