Sponsored Content
Full Discussion: Piping / Executing
Top Forums Shell Programming and Scripting Piping / Executing Post 302128243 by Shell_Life on Monday 23rd of July 2007 01:58:49 PM
Old 07-23-2007
If you want to execute each statement and check everytime if it is the
seventh hour, the following will create a 'Temp' shell script with all your
commands and a function 'f_test_time':
Code:
echo '#!/bin/ksh' > Temp
echo 'function f_test_time {}' >> Temp
echo 'typeset -i mDate' >> Temp
echo 'mDate=`date +"%H"`' >> Temp
echo 'if [ ${mDate} -eq 7 ]; then' >> Temp
echo 'echo "It is the seventh hour -- exiting."' >> Temp
echo 'exit' >> Temp
echo 'fi' >> Temp
echo '}' >> Temp
while read mLine
do
  echo $mLine >> Temp
  echo 'f_test_time' >> Temp
done < input_file

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

redirecting/piping

i want to fully undertand redirecting/piping. i know most of the basic stuff, like ls|less or cat file|grep hello etc etc. but there are a somethings like find / -name file 2>/dev/null. what's is the 2? i know it redirects the errors (at least Permission denied ones) to /dev/null (the unix... (3 Replies)
Discussion started by: crashnburn
3 Replies

2. Shell Programming and Scripting

Help (Piping ls, tr, cut)

I have to: pipe ls, tr, and cut to output the size (in bytes) and name of all of the files/dirs in the current directory (including any hidden ones), with the size at the beginning of the line, followed by a single tab character, followed by the the filename. I don't know what the point of... (2 Replies)
Discussion started by: scan
2 Replies

3. Shell Programming and Scripting

piping

I am using pipes (specifically piping out) in Perl to put an array from one file into an array in a different file. I can't figure out how to transfer the array. I kow how to open the pipe : open (FILEHANDLE, "| file") or die~ but how do I transfer the array. I think it has something to do with... (1 Reply)
Discussion started by: lnatz
1 Replies

4. Programming

Help with piping program

Hi, I am trying to write a program that will pipe any number of programs together like in the linux shell. As an example, the below code tries to execute "cat data | grep int | cut -b 1-10." The problem is that the programs never get executed for some reason. It seems like the first program... (3 Replies)
Discussion started by: PuppyHusher
3 Replies

5. Shell Programming and Scripting

Piping from device?

Hi Long time since I did any shell scripting so please be gentle with me! :) Just wanted to know whether it is possible to take the streaming output from a dvb card /dev/dvb/adapter0/ and using named pipes and tee to pass the outputs to mplayer and mencoder so as to watch and record a telly... (0 Replies)
Discussion started by: gary101
0 Replies

6. UNIX for Dummies Questions & Answers

Piping in UNIX

All, I am a UNIX novice with a question that I hope you can help me with. I have a UNIX application called "Tole" that formats and displays specific information about customers. I can display the information for up to 30 customers by seperating customer IDs using commas in this format: Tole -c... (3 Replies)
Discussion started by: simo007
3 Replies

7. Shell Programming and Scripting

Piping to ex from a script

Is anyone piping commands to ex from scripts? I.E. echo '%s/change this/to that/\nwq' | ex file.name I've been using it for years with AIX, Solaris, SGI, with variations ksh and Mandriva and others with pdksh. I've just started using CentOS with ksh and it no longer works. I've tried single... (2 Replies)
Discussion started by: mph
2 Replies

8. UNIX for Dummies Questions & Answers

Piping GREP

Hi, I need to use a double grep so to speak. I need to grep for a particular item say BOB and then for each successful result I need to grep for another item say SMITH. I tried grep "BOB" filename | grep "SMITH" but it does not seem to work. I can achieve my desired result using an... (12 Replies)
Discussion started by: mojoman
12 Replies

9. Ubuntu

Piping with grep

Hi everybody, I have a big file with blast results (if you know what this means, otherwise look at it just as a text file with a specific form). I am trying to extract some ids from within this file, which have certain parameters. For example, some Of my IDs have the term 'No hit results'... (6 Replies)
Discussion started by: frymor
6 Replies

10. UNIX for Dummies Questions & Answers

Piping commands

Hi I am tryin to undertand piping command1|command2 from what i learn output of cammand 2 is an intput for command 1 right? If so . What dose next sequence do cat f1 >> f2 | grep '^' I think it takes context of f1 and Concatenate's it to f2 and then looks for ....i don't know..... (7 Replies)
Discussion started by: iliya24
7 Replies
Test::Trap::Builder::SystemSafe(3)			User Contributed Perl Documentation			Test::Trap::Builder::SystemSafe(3)

NAME
Test::Trap::Builder::SystemSafe - "Safe" output layer backend using File::Temp VERSION
Version 0.2.3 DESCRIPTION
This module provides an implementation systemsafe, based on File::Temp, for the trap's output layers. This implementation insists on reopening the output file handles with the same descriptors, and therefore, unlike Test::Trap::Builder::TempFile and Test::Trap::Builder::PerlIO, is able to trap output from forked-off processes, including system(). See also Test::Trap (:stdout and :stderr) and Test::Trap::Builder (output_layer). CAVEATS
Using File::Temp, we need privileges to create tempfiles. We need disk space for the output of every trap (it should clean up after the trap is sprung). Disk access may be slow -- certainly compared to the in-memory files of PerlIO. If the file handle we try to trap using this backend is on an in-memory file, it would not be available to other processes in any case. Rather than change the semantics of the trapped code or silently fail to trap output from forked-off processes, we just raise an exception in this case. If there is another file handle with the same descriptor (f ex after an "open OTHER, '>&=', THIS"), we can't get that file descriptor. Rather than silently fail, we again raise an exception. Threads? No idea. It might even work correctly. BUGS
Please report any bugs or feature requests directly to the author. AUTHOR
Eirik Berg Hanssen, "<ebhanssen@allverden.no>" COPYRIGHT &; LICENSE Copyright 2006-2012 Eirik Berg Hanssen, All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.18.2 2017-10-06 Test::Trap::Builder::SystemSafe(3)
All times are GMT -4. The time now is 02:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy