10-16-2014
Thanks to bakunin for his interesting lecture on piping commands to ksh.
And thanks to MadeInGermany for converting the sed command to non-GNU syntax.
I love short and straight forward code solutions.
I will surely save these two sed lines to my examples file.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a few scripts that i would like to make into GUI's. Are there scripting commands to make GUI's if so where can i get the list of commands and what they do or if anyone has an example of it. Anything will help, thanks (1 Reply)
Discussion started by: daltonkf
1 Replies
2. UNIX for Dummies Questions & Answers
I am trying to get various portions of strings in my script, but am getting a substitution error. I followed the syntax that was described when I goggled this, but I can't get anything to work.
#! /bin/ksh/
hello="adklafk;afak"
#hello=${hello:3}
hello=${$hello:3}
happy="hey"
echo... (1 Reply)
Discussion started by: anderssl
1 Replies
3. UNIX for Dummies Questions & Answers
It would be helpful if someone could help me out here. The problem I have been having is that I cannot run some commands which are valid - whenever I try to run the command I get the message "command not found". Now, if I run the same command as root it executes. These commands do not have to be... (5 Replies)
Discussion started by: BigTool4u2
5 Replies
4. Shell Programming and Scripting
I want to write a script which would run from one host say A and connect to other remote host B and then run rest of commands in that host. I tried connecting from A host to B with SSH but after connecting to host B it just getting me inside Host B command prompt. Rest of the script is not running... (6 Replies)
Discussion started by: SN2009
6 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I am wondering how I can check the return value of all commands in a pipe such as
gzip -dc file.gz | sort -u > output.txt
If I run this sequence in bash and check $?, I get the return status from sort. But I want to know if the initial gzip failed.
Similarly for longer pipe chains,... (6 Replies)
Discussion started by: btherl
6 Replies
6. UNIX for Advanced & Expert Users
Are there any documents available for checking the execution time taken by ksh commands?
My requirement is to fine tune a set of shell scripts having lot of "echos" and "date"s.
Is there a better replacement for the below code?.
echo "ABC process started on `date`"
some code..
echo... (12 Replies)
Discussion started by: engineer
12 Replies
7. Shell Programming and Scripting
Hi
I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email.
For example
-------
Script ABC
-------
a.ksh
b.ksh
c.ksh
I need to call all three scripts execute them and... (2 Replies)
Discussion started by: pacifican
2 Replies
8. UNIX for Dummies Questions & Answers
works fine.
echo "Deleting CHOPOne Coreaccess from LAUA..."
$ORACLE_HOME/bin/sqlplus username/password@servername << !
delete from usergrpdtl where username='acker';
commit;
!
but not working with "if statement" even $TMPDIR/adlogin.log exists and greater than 0.
if
then
... (9 Replies)
Discussion started by: lawsongeek
9 Replies
9. Shell Programming and Scripting
What is the correct syntax to pipe or run three awk commands? Basically, using the output of the first awk as input in the second. Then using the output of the second awk in the third. Thank you :).
awk 'FNR==NR {E; next }$3 in E {print $3, $5}' panel_genes.txt RefSeqGene.txt > update.txt |... (3 Replies)
Discussion started by: cmccabe
3 Replies
10. Linux
Hello,
I have standard loop
while read -r info; do
command $info
done < info
in info text file I have multiple commands each on line that I want to execute. When I used them in console they worked, but not with this loop.
This is one of the commands in info file:
grep... (4 Replies)
Discussion started by: adamlevine
4 Replies
pipe(2) System Calls Manual pipe(2)
Name
pipe - create an interprocess channel
Syntax
include <limits.h> /*Definition of PIPE_MAX*/
pipe(fildes)
int fildes[2];
Arguments
fildes Passing an address as an array of two integers into the system call.
Description
The system call creates an I/O mechanism called a pipe. The file descriptors returned can be used in and operations. Their integer values
will be the two lowest available at the time of the function call. The O_NONBLOCK and FD_CLOEXEC flags will be clear on both file descrip-
tors.
When the pipe is written using the descriptor fildes[1], up to PIPE_MAX bytes of data are buffered before the writing process is suspended.
A read using the descriptor fildes[0] picks up the data.
It is assumed that after the pipe has been set up, two (or more) cooperating processes (created by subsequent calls) pass data through the
pipe with and calls.
The shell has a syntax to set up a linear array of processes connected by pipes.
For further information on how and calls behave with pipes, see the and reference pages.
A signal is generated if a write on a pipe with only one end is attempted.
Restrictions
Should more than 4096 bytes be necessary in any pipe among a loop of processes, deadlock may occur.
The underlying implementation of pipes is no longer socket based, but rather implemented through the file system. Any application that
needs socket functionality from pipes should use the system call.
Return Values
The function value zero is returned if the pipe was created; -1 if an error occurred.
Diagnostics
The call fails 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.
Environment
Differs from the System V definition in that ENFILE is not a possible error condition.
See Also
sh(1), fork(2), read(2), socketpair(2), write(2)
pipe(2)