The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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
Help with exec command and file descriptors?? rfourn Shell Programming and Scripting 1 07-18-2007 06:05 PM
exec command and field descriptors.. moxxx68 UNIX for Dummies Questions & Answers 5 12-04-2004 05:58 PM
file descriptors a25khan UNIX for Dummies Questions & Answers 3 01-27-2004 07:46 PM
File Descriptors shibz UNIX for Advanced & Expert Users 3 12-18-2002 10:12 AM
File Descriptors s_chordia High Level Programming 2 12-24-2001 11:45 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-18-2008
masaki masaki is offline
Registered User
  
 

Join Date: Mar 2008
Location: Tokyo, Japan
Posts: 2
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 (permalink)  
Old 03-18-2008
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,101
You can't do that. ksh can only control 0 through 9 directly.
  #3 (permalink)  
Old 01-03-2009
tkang007 tkang007 is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 3
At ksh, I can only close fd to 9 as your case.
But, I can do it by using Perl as the following test case.
t1.c : open 10 files
t2.pl : close fd from 3
t3.c : only wait a key to verify fds by using AIX 5.3 dbx's fd subcomamnd.

At p2.pl
use POSIX::close

for ($fd=100; $fd > 2; $fd--) { # 100 is ok on my case.
POSIX::close($fd) # execution error, but has effect.
}

exec "./t3"
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 11:40 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0