Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Accessing redirected file inside script Post 302105413 by sb008 on Thursday 1st of February 2007 02:31:05 PM
Old 02-01-2007
On Solaris sytems you can:

The script:
-------------------------
#!/usr/bin/ksh

pfiles $$
-------------------------


The command line:
-------------------------
./test.sh > out 2> out2
-------------------------

The output (in the file "out")
-------------------------
$ cat out
19888: /usr/bin/ksh ./test.sh
Current rlimit: 256 file descriptors
0: S_IFCHR mode:0620 dev:283,0 ino:12582918 uid:107 gid:7 rdev:24,1
O_RDWR|O_NOCTTY|O_LARGEFILE
/devices/pseudo/pts@0:1
1: S_IFREG mode:0640 dev:85,60 ino:2023 uid:107 gid:150 size:0
O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE
/export/home/XXXXX/out
2: S_IFREG mode:0640 dev:85,60 ino:2027 uid:107 gid:150 size:0
O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE
/export/home/XXXXX/out2
62: S_IFREG mode:0750 dev:85,60 ino:456 uid:107 gid:150 size:26
O_RDONLY|O_LARGEFILE FD_CLOEXEC
/export/home/XXXXX/test.sh
-------------------------

The Output shows the file descriptors
1 for stdout (redirected to file "out")
1: S_IFREG .............
The last line shows the file whereto stdout has been redirected to.
/export/home/XXXXX/out
2: for stderr (redirected to the file "out2")
2: S_IFREG .............
Again, the last line shows the file whereto stderr has been redirected to.
/export/home/XXXXX/out2
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Saving a redirected file

What command do I use in order to save a file in directory A/B/C to directory A/D/E. (1 Reply)
Discussion started by: JSP
1 Replies

2. UNIX for Dummies Questions & Answers

accessing shell script variable in file

Hi, I have a shell script in which there is a file conn_$temp where $temp has the pid of the shell script. in this shell script i have an embedded awk script that must read the file while ((getline < "conn_$temp") > 0) However due to the "$temp" in the file name, the awk script is... (6 Replies)
Discussion started by: HIMANI
6 Replies

3. UNIX for Dummies Questions & Answers

redirected output not going to file for all cases

I have to confirm that an engine was not able to run. In the output below you see that it indeed got errors, but it didn't send those messages to the output file. When I run the same thing with a different executable it works. So does this mean something in the executable could cause it not to... (7 Replies)
Discussion started by: brdholman
7 Replies

4. UNIX for Dummies Questions & Answers

Accessing a log file from html, coldfusion script

I have a question. I am not even sure if it can be done. But if it could be then I would needs a lot of help. ok, I work for a software company and we have a store. The store log files are in a unix server and the log file is dynamically updated everytime some error occurs in the store. So we often... (1 Reply)
Discussion started by: skrules
1 Replies

5. Shell Programming and Scripting

Sed inside bash script - accessing multiple files

I have a file (email) containing email addresses. I have a second file (terms) that contains simple regular expressions and words/characters. Here are some examples: \.trainee \.group \.web I want to go through email and delete lines containing the expressions/words from terms and write... (1 Reply)
Discussion started by: manouche
1 Replies

6. UNIX for Dummies Questions & Answers

How to get redirected filename inside unix script

Hi All, I am having a script which calculate checks the input feed and perform some function. When i am executing this script i am redirecting this to a output file. I want to know the redirected output file name inside my scripts. Is there is any way to get that . like the same way we... (4 Replies)
Discussion started by: arunkumar_mca
4 Replies

7. Shell Programming and Scripting

Error during Accessing Global variable inside function

emailid=myemail@xyz.com taskName="DB-Backup" starttime=`date` email() { subject="$taskName" ": " $* " at `date` " mutt -s "$subject" $emailid < /dev/null } email "Starting" #do my stuff email "Finished" The above code gives following error ./dbbackup.sh: line 6: :... (5 Replies)
Discussion started by: nitiraj.rathore
5 Replies

8. Shell Programming and Scripting

Perl: accessing reference to variable inside hash.

Below is hash which contains reference to variables: my %mandatoryFields = ( 1 => \$msgtype, 2 => \$switchtype, 3 => \$card_nbr, 4 => \$natv_tran_type_code, 5 => \$amt_1 ); This... (0 Replies)
Discussion started by: som.nitk
0 Replies

9. Shell Programming and Scripting

Issue with accessing value inside while loop, outside it

Hi, GetName() { if then echo " Please enter the name: " read Name tempvar=0 while read line do if then tempvar=`expr $tempvar + 1` echo $tempvar ... (10 Replies)
Discussion started by: rituparna_gupta
10 Replies

10. Shell Programming and Scripting

Deleting redirected pwd from file.

Hi echo " username " read username echo "password" stty -echo read password stty echo through read i am taking standard input and redirecign them to a file echo " username=${username}/${password} " > file.lst now from the same shell script i want to delete the password (i.e... (4 Replies)
Discussion started by: rosheks
4 Replies
qmail-users(5)                                                  File Formats Manual                                                 qmail-users(5)

NAME
qmail-users - assign mail addresses to users OVERVIEW
The file /var/lib/qmail/users/assign assigns addresses to users. For example, =joe.shmoe:joe:503:78:/home/joe::: says that mail for joe.shmoe should be delivered to user joe, with uid 503 and gid 78, as specified by /home/joe/.qmail. Assignments fed to qmail-newu will be used by qmail-lspawn to control qmail-local's deliveries. See qmail-newu(8). A change to /var/lib/qmail/users/assign will have no effect until qmail-newu is run. STRUCTURE
/var/lib/qmail/users/assign is a series of assignments, one per line. It ends with a line containing a single dot. Lines must not contain NUL. SIMPLE ASSIGNMENTS
A simple assignment is a line of the form =local:user:uid:gid:homedir:dash:ext: Here local is an address; user, uid, and gid are the account name, uid, and gid of the user in charge of local; and messages to local will be controlled by homedir/.qmaildashext. If there are several assignments for the same local address, qmail-lspawn will use the first one. local is interpreted without regard to case. WILDCARD ASSIGNMENTS
A wildcard assignment is a line of the form +loc:user:uid:gid:homedir:dash:pre: This assignment applies to any address beginning with loc, including loc itself. It means the same as =locext:user:uid:gid:homedir:dash:preext: for every string ext. A more specific wildcard assignment overrides a less specific assignment, and a simple assignment overrides any wildcard assignment. For example: +:alias:7790:2108:/var/lib/qmail/alias:-:: +joe-:joe:507:100:/home/joe:-:: =joe:joe:507:100:/home/joe::: The address joe is handled by the third line; the address joe-direct is handled by the second line; the address bill is handled by the first line. SEE ALSO
qmail-pw2u(8), qmail-newu(8), qmail-lspawn(8) qmail-users(5)
All times are GMT -4. The time now is 07:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy