![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| File Descriptor Table | Ashaman0 | UNIX for Advanced & Expert Users | 6 | 12-03-2007 02:54 PM |
| File descriptor constant | vino | High Level Programming | 4 | 05-18-2005 02:18 AM |
| File Descriptor Help | rahulrathod | UNIX for Dummies Questions & Answers | 3 | 10-14-2004 06:08 AM |
| file activity (open/closed) file descriptor info using KORN shell scripting | Gary Dunn | UNIX for Dummies Questions & Answers | 3 | 06-07-2004 02:54 PM |
| bad file descriptor? | ftb | UNIX for Dummies Questions & Answers | 1 | 02-20-2002 07:19 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
I am trying to right a function which uses a file descriptor to write to a log file. The problem is that the on the print statement the file descriptor is called bad. Now when I first open the file and print to it in the f_open function by passing the descriptor to f_print_log all works well, however when I returned the file descriptor to logtest.sh and then try to pass it to f_print_log I get bad file descriptor. Any help would be appreciated. Here are my functions and calling script:
********* THESE FUNCTIONS ARE IN f_log.sh function f_open_log { next_fh=$LOG_FH_COUNTER eval "exec $next_fh>$1" f_print_log $next_fh "Log file opened" (( LOG_FH_COUNTER=LOG_FH_COUNTER + 1 )) echo ${next_fh} return 0 } function f_print_log { print -u$1 $2 return 0 } *************************************************** logtest.sh --> #!/bin/ksh . f_log.sh typeset -i LOG_FH_COUNTER=3 LOG=$(f_open_log bigfile) f_print_log $LOG "This is a test" exit |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|