02-19-2008
for i in `ls`; do echo $i;done
-ilan
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hi,
I had a process that was producing a standard output (no log of it eing produced), unfortunalty the xterm it was running in died and I lost the output. I have logged back in and can see that the process didn't die. How can I bring this process to the foreground so that I can see the output?... (2 Replies)
Discussion started by: nhatch
2 Replies
2. UNIX for Dummies Questions & Answers
Dear guru,
Say I have a long process that is executed in this way:
$ nohup perl mycode.pl > output.txt &
Now if I want to view the output file with vi, while process
still running:
$ vi output.txt
Will it kill the process? (seems to me it does). If so how can view the file
without... (4 Replies)
Discussion started by: monkfan
4 Replies
3. Shell Programming and Scripting
I'm trying to get the ps command to just output the name of the processes currently running, but I can't figure out a way to do it. I'm using OSX, so some UNIX features are crippled. Is there any way for me to do this?
Thanks,
Black Leopard (4 Replies)
Discussion started by: blckleprd
4 Replies
4. Shell Programming and Scripting
HI all!
I have a problem parsing the output of another process. The output is like this (C):
printf("\rCheck exist: %d/%d",idx,pBF->NBits());
The aim of the script I'm coding is to save in a separate file the last output line of first process.
This is the script now (Shell script):
... (3 Replies)
Discussion started by: victorin
3 Replies
5. Shell Programming and Scripting
When I run <ls -l> to get a list of all the files, I want the displayed result to be written to a text file. Is there a way to do that? (1 Reply)
Discussion started by: kn.naresh
1 Replies
6. Programming
Can you help me ?
I want to write a program ,which can open a input file (input.txt) and run as child process ,then write to output file (output.txt).......
char inFile="input.txt";
char outFile="output.txt";
int main(int argc, char **argv)
{
pid_t pid=1;
int no=0; // no. of... (5 Replies)
Discussion started by: cupid1575
5 Replies
7. Shell Programming and Scripting
Hello Friends,
I'm trying to save process status of root user sorting by CPU usage. However i couldnt save the continuous, standard outputs into a file. Do you have any idea to do it?
prstat -u root -a -s cpu | sed -e '/^$/d;/sleep/d;/Total/d' >> stat.txt
>ls -l stat.txt
-rw-r--r-- 1... (1 Reply)
Discussion started by: EAGL€
1 Replies
8. UNIX for Dummies Questions & Answers
I'm pretty sure I had the answer to this months ago and have misplaced it. Needless to say I will bookmark it this time.
I have a background process that's been running way longer than usual. It doesn't output anything to a file, so I can't 'tail -f' it. Is there a command that will enable me to... (2 Replies)
Discussion started by: dheian
2 Replies
9. Shell Programming and Scripting
Looking to create a script to listen to each output from a task while it is running and launch a function if a specific error message is found at any point and if not to continue uninterrupted.
#!/bin/bash
read checker <<< $(reaver -i mon0 -b 'target bssid' -vv)
if ; then
function
elif... (1 Reply)
Discussion started by: 3therk1ll
1 Replies
10. Shell Programming and Scripting
I was looking for samething more compact than this:
$: a=`ls`
$: declare -i num=0
$: for x in $a; do num=$num+1; echo "$num ..... $x"; echo "$num $x">fl_tmp; done
And jump in my mind to use parallel but look at the performance:
$: a=`ls`
$: time for n in {1..10}; do parallel... (3 Replies)
Discussion started by: flaviofachin
3 Replies
exec(1) User Commands exec(1)
NAME
exec, eval, source - shell built-in functions to execute other commands
SYNOPSIS
sh
exec [argument...]
eval [argument...]
csh
exec command
eval argument...
source [-h] name
ksh
*exec [arg...]
*eval [arg...]
DESCRIPTION
sh
The exec command specified by the arguments is executed in place of this shell without creating a new process. Input/output arguments may
appear and, if no other arguments are given, cause the shell input/output to be modified.
The arguments to the eval built-in are read as input to the shell and the resulting command(s) executed.
csh
exec executes command in place of the current shell, which terminates.
eval reads its arguments as input to the shell and executes the resulting command(s). This is usually used to execute commands generated as
the result of command or variable substitution.
source reads commands from name. source commands may be nested, but if they are nested too deeply the shell may run out of file descrip-
tors. An error in a sourced file at any level terminates all nested source commands.
-h Place commands from the file name on the history list without executing them.
ksh
With the exec built-in, if arg is given, the command specified by the arguments is executed in place of this shell without creating a new
process. Input/output arguments may appear and affect the current process. If no arguments are given the effect of this command is to mod-
ify file descriptors as prescribed by the input/output redirection list. In this case, any file descriptor numbers greater than 2 that are
opened with this mechanism are closed when invoking another program.
The arguments to eval are read as input to the shell and the resulting command(s) executed.
On this man page, ksh(1) commands that are preceded by one or two * (asterisks) are treated specially in the following ways:
1. Variable assignment lists preceding the command remain in effect when the command completes.
2. I/O redirections are processed after variable assignments.
3. Errors cause a script that contains them to abort.
4. Words, following a command preceded by ** that are in the format of a variable assignment, are expanded with the same rules as a vari-
able assignment. This means that tilde substitution is performed after the = sign and word splitting and file name generation are not
performed.
EXIT STATUS
For ksh:
If command is not found, the exit status is 127. If command is found, but is not an executable utility, the exit status is 126. If a redi-
rection error occurs, the shell exits with a value in the range 1-125. Otherwise, exec returns a zero exit status.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO
csh(1), ksh(1), sh(1), attributes(5)
SunOS 5.10 17 Jul 2002 exec(1)