File redirection

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers File redirection
# 1  
Old 01-10-2002
Power File redirection

Is it possible to sh a command and receive the standard output on the scrren and use file redirection ie ls -lt > test. Also On SCO-UNIX there was a tellme command which displayed a message when a script had finished running is there something similar for HP UNIX as it is not working.
# 2  
Old 01-10-2002
You could look into the "tee" command for displaying output on the screen AND capturing it in a file.

As for the other command, I am not familiar with it, but I bet it could be easily reproduced in a shell script. Could you describe the features you are looking for?

Hope that helps.
# 3  
Old 01-10-2002
when I use the at command I want to get a reply when the job has finished I used to use the tellme but I'm not so sure what to use now
# 4  
Old 01-10-2002
I couldn't find any information in a quick search on that command... was it custom script, or one that shipped with SCO?

Either way, do you want it to mail you? If so, you might be able to use something like this:
# - mail me when a command 
# completes.
trap "rm -f ${TMP_FILE} 2> /dev/null" EXIT
>$TMP_FILE; chmod 600 $TMP_FILE
if [ -z "${MY_ARGS}" ]; then
     echo "No  command to run! " > $TMP_FILE
     echo "Started ${MY_ARGS} at `date` > ${TMP_FILE}
     ${MY_ARGS} >> ${TMP_FILE} 2>&1
     echo "Finished at `date` >> ${TMP_FILE}
mail Your_Username < ${TMP_FILE}

You can fit this to your needs, of course... Will this work for you?

Keep in mind that I did not test this - I just typed it out... make sure to test it for your needs before using it regularly.
# 5  
Old 01-10-2002
kewl ... going to give it a try. thanks for the help
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem with file redirection in while

I've got a problem with file redirection in bash, in loop while (in my script done < bufor.txt). In every consecutive iteration there's a possibility that to the bufor.txt will be added some lines. Unfortunately, in loop, added lines are ignored (for example: bufor.txt has 5 lines, in 3rd iteration... (4 Replies)
Discussion started by: kk9
4 Replies

2. Shell Programming and Scripting

Output redirection of c binary file to a file in shell script is failing

I am struck up with a problem and that is with output redirection. I used all the ways for the redirection of the output of c binary to a file, still it is failing. Here are the different ways which I have used: ./a.out | tee -a /root/tmp.txt 2>&1 ./a.out | tee -a /root/tmp.txt 1>&1 ./a.out |... (2 Replies)
Discussion started by: Maya29988
2 Replies

3. Solaris

LS redirection to a file in same folder

Hello, I need an input from you all. I want to redirect the output of 'ls' command to a file but the file should not display the output file name in it. scenario: ------------ $pwd /home/user1 $ls file1 file2 $ls > file3 $cat file3 file1 file2 file3 In this i dont wish... (6 Replies)
Discussion started by: aravindan
6 Replies

4. UNIX for Advanced & Expert Users

File Descriptor redirection and duplication

i have many questions concerning the FD. it was stated that "to redirect Error to output std, you have to write the following code" # ls -alt FileNotThere File > logfile 2>&1 # cat logfile ls: cannot access FileNotThere: No such file or directory -rw-r--r-- 1 root root 0 2010-02-26... (9 Replies)
Discussion started by: ahmad.zuhd
9 Replies

5. UNIX for Dummies Questions & Answers

Output file redirection

Suppose I have a file named a When I write cat a>a The following error message is displayed cat: a: input file is output file and my file a is truncated to zero size. Also the exit status of the last command is 1 Can someone tell me what actually happens when I do so? (1 Reply)
Discussion started by: aagajaba
1 Replies

6. Shell Programming and Scripting

File redirection question

Hi all, I am working with the Grinder tool (unrelated to my question) to redirect the output of a program to a file as follows: java -cp $CLASSPATH net.grinder.TCPProxy > grinder.txt This is a proxy server which pipes output to a file. When I do something on my proxy, more and more goes to... (1 Reply)
Discussion started by: Annorax
1 Replies

7. Shell Programming and Scripting

fbackup redirection to a file.

Hi, I have a fbackup step as below /bin/nice /etc/fbackup -f /dev/rmt/0m -i / -I /opt/monitrol/tmp/Index.full Now the errors that i will get in case of the fbackup step, I want to redirect them to a file. Please help me how to redirect to a file. Thanks, Avik. (5 Replies)
Discussion started by: avik.nandi
5 Replies

8. Shell Programming and Scripting

file redirection problem

my querry is suppose i have duplicate std i/p with FD-3 --exec 0<&3 now redirected std i/p to a file ----exec 0<file1 suppose i am reading the file line by line --while read LINE cutting some fields and comparing it with a variable and if a match is found ... (0 Replies)
Discussion started by: mobydick
0 Replies

9. Shell Programming and Scripting

Error file Redirection

Hello All, I was wondering is there any other way in Shell Scripting to redirect the errors to a output file inside a shell script with using a error status checking or a command line redirection. Say without doing this ksh test.ksh 2> error.txt or without doing this ... if ; then... (3 Replies)
Discussion started by: maxmave
3 Replies

10. Shell Programming and Scripting

awk two file redirection

Hi, i use awk -F to print three variable delimited by comma $1 $2 $3 if $2=="" i want to extract this information missing from another file using awk -v + some process. but the problem i can't use the two awk together cause of redirection there's a solution. note: i can't use another... (1 Reply)
Discussion started by: kamel.seg
1 Replies
Login or Register to Ask a Question