What does the following exec command do it is in the shell file?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting What does the following exec command do it is in the shell file?
# 1  
Old 06-04-2017
What does the following exec command do it is in the shell file?

I have a shell script, research_dump_sub.sh
the first 3 lines are below. the below two lines writing to log file, i am not finding the log file, how to locate, and what is the exec command doing exactly please.
and the third line again calling/triggering the shell file. i didn't understood.

Thanks a lot for the helpful info.

Code:
exec >  >(tee -ia /TTH_WORK_DIR/LOGS/research_FTP_dump.log)


exec 2> >(tee -ia /TTH_WORK_DIR/LOGS/research_FTP_dump.log >&2)

./Research_dump_sub.sh

# 2  
Old 06-04-2017
Hmm. Is the process run normally under a chrooted user? i.e., the user is in a chroot jail so the

Code:
/TTH_WORK_DIR/LOGS/

would exists for that user off the root directory.

I am assuming you executed this and found nothing:
Code:
find / -type d -name 'TTH_WORK_DIR'

And there are no links in the user's home directory by the same name.
# 3  
Old 06-05-2017
As for the exec question, c.f. man bash:
Quote:
exec [-cl] [-a name] [command [arguments]]
If command is specified, it replaces the shell. No new process is created. . . .
If command is not specified, any redirections take effect in the current shell, and the return status is 0.
As for the redirections: they make use of the shell's "process substitution" (c.f. e.g. man bash) which in turn uses the tee command to both display to stdout and log to the file given.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Linux find command seems to not transmit all the result to the '-exec command'

Hello. From a script, a command for a test is use : find /home/user_install -maxdepth 1 -type f -newer /tmp/000_skel_file_deb ! -newer /tmp/000_skel_file_end -name '.bashrc' -o -name '.profile' -o -name '.gtkrc-2.0' -o -name '.i18n' -o -name '.inputrc' Tha command... (3 Replies)
Discussion started by: jcdole
3 Replies

2. Shell Programming and Scripting

"exec" command. Stopoutput to file.

I have a script (ksh, Linux) which is about 500 lines and this is only a small requirement. Below is an example of my requirement. FunctionThis(){ echo "You are in this. Goes to log" } FunctionThat(){ echo "You are in That. Goes to log" } FunctionScreen(){ echo "You are in Screen.... (3 Replies)
Discussion started by: edidataguy
3 Replies

3. UNIX for Dummies Questions & Answers

Exec command

Hi can some one explain the following command , It would really help if some can really elloborate on what is happening out here export PATH | exec /bin/sh ./auto_approve :q P.S: This is the first time i am using exec ,so an elloboration what does it do and what is the use of the :q will be... (1 Reply)
Discussion started by: Sri3001
1 Replies

4. Shell Programming and Scripting

Appending to a file using exec command

Hi, I need the data to be appended to the file using exec command in linux. I am able to add the data to a file using exec command but the file is getting overwritten. Above exec command is used to overwite in a file. When I use "exec >>& fileName", getting "syntax error near... (3 Replies)
Discussion started by: Anjan1
3 Replies

5. Shell Programming and Scripting

Help with exec command and file descriptors II

Need to close files which descriptor number are larger than 9 in ksh. 'exec 10>&-' fails with 'ksh: 10: not found'. How do you specify file descriptors which occupies two or more digits in ksh script? Thanks, Masaki (2 Replies)
Discussion started by: masaki
2 Replies

6. Shell Programming and Scripting

how to use exec command in C shell

i have a script where i am reading some lines from a file into another file.. script works fine in bash.. #!/usr/bin/csh awk 'NR>20&&NR<32' try.sum | awk '{print $4 }' >io awk 'NR>20&&NR<32' try.sum | awk '{print $9 }' >io1 awk 'NR>20&&NR<32' try.sum | awk '{print $14 }'>io2 exec 10<io... (1 Reply)
Discussion started by: npatwardhan
1 Replies

7. Shell Programming and Scripting

Help with exec command and file descriptors??

im having trouble with the comprehending the exec command and the use of file descriptors. given: #!/bin/sh exec 4>&1 exec 1>&2 exec 2>&4 exec 4>&- echo Hello would the standard output of this script be sent to STDOUT, STDERR or neither and why??? thanks for the help. (1 Reply)
Discussion started by: rfourn
1 Replies

8. UNIX for Dummies Questions & Answers

using the -exec command

linux redhat 8.0 I am getting accustomed to using the -exec command to get around my databse.. and use it to edit and update files..! is this more apllicable than jumping from one directory to the other.. I have set up the databse so that the inode #'s are accessable and can get me from one... (0 Replies)
Discussion started by: moxxx68
0 Replies
Login or Register to Ask a Question