Sponsored Content
Top Forums Shell Programming and Scripting Using output to input another command Post 302167367 by joeyg on Thursday 14th of February 2008 09:03:37 AM
Old 02-14-2008
Tools Use a for loop

#! /bin/bash

for zf in *myfile*.*
do
ls -l $zf
tail $zf
done

Notes:
(1) I do an ls command; not needed - just shows what file is being looked at in the loop
(2) tail is its own command line since guess you want to do more than simply execute this one command

This could all be done in one line as:
tail *myfile*.*
but, I figure this is part of something more complicated.
So, two choices.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using Output from one command as input to another

This site has been very helpful thus far.. I thank you all in advance for sharing the knowledge. Let me get to it. I am trying to write a very small script to take away from the boredom of doing the same thing over and over. Everynow and again I have to get the hex value of a file using a... (2 Replies)
Discussion started by: BkontheShell718
2 Replies

2. UNIX for Dummies Questions & Answers

problem with output of find command being input to basename command...

Hi, I am triying to make sure that there exists only one file with the pattern abc* in path /path/. This directory is having many huge files. If there is only one file then I have to take its complete name only to use furter in my script. I am planning to do like this: if ; then... (2 Replies)
Discussion started by: new_learner
2 Replies

3. UNIX for Dummies Questions & Answers

Command display output on console and simultaneously save the command and its output

Hi folks, Please advise which command/command line shall I run; 1) to display the command and its output on console 2) simultaneous to save the command and its output on a file I tried tee command as follows; $ ps aux | grep mysql | tee /path/to/output.txt It displayed the... (7 Replies)
Discussion started by: satimis
7 Replies

4. Shell Programming and Scripting

how to input the CAT command output in Shell

Hi guys... I am new to this scripting...so please forgive me if anything worng in my questions... here is my question.. I have file structure /home/oracle/<sid>/logs/bkup now i want to write a script which should grep the sid name from a file..and it should replace the <SID> with... (1 Reply)
Discussion started by: troubleurheart
1 Replies

5. UNIX for Dummies Questions & Answers

Send output of grep as input of kill command

I would appreciate any help. I need to run 'ps -ef | grep 'process', get the process id and kill that process. I have got this far: - Get pid using ps -ef | awk '/process/{ print $2}' after this I'm kind of stuck.. - Use pipe to redirect the output to kill pid=ps -ef | awk '/bmserver/{... (2 Replies)
Discussion started by: foxtron
2 Replies

6. Shell Programming and Scripting

Command Output to Standard Input

Hi All, How do I provide the output of a command to another command which is waiting for an input from the user ? Ex : I need to login to a device via telnet. In the script, initially I use the "read" command to get the IP Address, Username and Password of the device from the user. Now,... (1 Reply)
Discussion started by: sushant172
1 Replies

7. UNIX for Dummies Questions & Answers

Using grep output as input for sed command

Hi, I would like to know if this is possible, and if so what can i do to make this work. I would like to grep a line X from fileA and then use the output to replace a word Y in fileB. grep "line X" fileA | sed -e 's/Y/X/g' > outfile this statement does not work, as i do not know how to... (7 Replies)
Discussion started by: cavanac2
7 Replies

8. Shell Programming and Scripting

Script output as input for next command

Hi All, Hoping you can help as im in desperate need... I'm very new to unix scripting so apoligies, I have setup an expect script in order to log into a node on our network, This will provide an output as per the below *********** information: *************: n/a TEST IP : n/a ... (18 Replies)
Discussion started by: mutley2202
18 Replies

9. UNIX for Dummies Questions & Answers

Cut command, no input delim, output delim not working

Hello, I'm using cygwin on my Windows 7 machine. From the man pages of cut: --output-delimiter=STRING use STRING as the output delimiter the default is to use the input delimiter I tried the following commands and got the error messages: $ cut -c1-10,20-30 -d... (10 Replies)
Discussion started by: kojac
10 Replies

10. Shell Programming and Scripting

Insert title as output of command to appended file if no output from command

I am using UNIX to create a script on our system. I have setup my commands to append their output to an outage file. However, some of the commands return no output and so I would like something to take their place. What I need The following command is placed at the prompt: TICLI... (4 Replies)
Discussion started by: jbrass
4 Replies
KAPTAIN(1)						      General Commands Manual							KAPTAIN(1)

NAME
kaptain - Universal graphical front-end for command-line programs. SYNOPSIS
kaptain [options] file DESCRIPTION
kaptain reads the given file and builds a user-friendly dialog according to the grammar rules found in it. See info kaptain for a detailed overview. OPTIONS
kaptain accepts the following options: -h, --help Show summary of options. -V Run in verbose mode. --version Show version of program. --test Run in test mode. This means that commands are not executed when a button is pressed, only printed to the standard output. -V, --verbose Report more information on processing the input file. Internal representation of the grammar and the dialog tree is also printed. Use this flag if Kaptain does not work as expected. -c <host:port>, --client <host:port> Establish communication channel as a client connecting to a server on <host> listening on <port>. -s <port>, --server <port> Listen to the specified <port> and accept the first connection. This will be used as a communication channel. -p <command>, --pipe <command> Start the given command and communicate with it on its standard input and output. Don't forget to quote <command> if it contains spaces or other metacharacters used by the shell. --stdio Use standard input and output for communication. In this case you must specify an input file, thus grammar script cannot be read from the standard input when it is used as a communication channel. --no-input Instructs Kaptain not to process messages received on the input channel. --no-output If this flag is set, Kaptain will not send any messages on its output channel. AUTHOR
Zsolt Terek <terek@users.sourceforge.net>. September 11, 2004 KAPTAIN(1)
All times are GMT -4. The time now is 10:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy