09-29-2001
When a program is loaded by the OS,
it is automatically given 3 open files...
stdin -> fd=0
stdout -> fd=1
stderr -> fd=2
By closing all fd's you guarantee that
the next file you open...
open(...)
...will be assigned fd 0
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hello all,
I need to create a password change utility for a database. I need to gather at the command line the username, password and database sid. I have the program currently doing this. What I would like to do is not have the new password appear on the screen when I do my read command.... (2 Replies)
Discussion started by: whited05
2 Replies
2. Cybersecurity
I'm doing a security sweep of a Sun Sol 5.8 system. The file: /dev/console, which links to /devices/pseudo/cn@0:console, has the following perms: crw--w--w- I would like to get rid of the world write permissions. I can change the file permissions, but as soon as log back in, they are changed... (4 Replies)
Discussion started by: ErnieG
4 Replies
3. UNIX for Dummies Questions & Answers
Hi,
Please help me out on this one.
I want to send the output of a file as input for changing the date using date command.
Example, i have a file date.txt whose contents are 081014462009
I need to use the date in that file as input for date command.
I tried cat date.txt | date ; but it... (2 Replies)
Discussion started by: foxtron
2 Replies
4. Shell Programming and Scripting
Being new to this area .I have been assigned a task which i am unable to do . Can any one please help me .
Hi I have requirement where i have input file XYZ_111_999_YYYYMMDD_1.TXT and with header and series of Numbers and Footer.
I want to create a mutiple output files with each file having a... (2 Replies)
Discussion started by: bhargavkr
2 Replies
5. UNIX for Dummies Questions & Answers
Bonjour,
Mon application en C sous linux tourne en redirigeant stdin vers un fichier.
Exemple; $appli1 <file1.
PB: Je voudrais temporairement redonner la main au user sur le clavier.
Alors je pensais ajouter system("appli2"); dans appli1.
Dans son main() , appli2() fait seulement un... (1 Reply)
Discussion started by: cypleen
1 Replies
6. UNIX for Dummies Questions & Answers
Hello,
my C application under unix runs in redirecting stdin to a file.
Example:$appli1 <file1. This application waits often on a scanf().
But I would temporarely reassign stdin at the keyboard for waiting a user's answer. So I thought to add system("appli2"); in the code of appli1. In its... (4 Replies)
Discussion started by: cypleen
4 Replies
7. UNIX for Advanced & Expert Users
hi 2 all
whatever in a file that line have to come in console screen .. when i execte that script ...
>cat abc
date
ls
>./abc
>date ---->that line hav to come here
> ls ----> that line hav to come here
please anyone help me ! (4 Replies)
Discussion started by: ponmuthu
4 Replies
8. Shell Programming and Scripting
Hi ,
I have script in that , i uninstall rpm using rpm -ef $rc1
now my query is rpm -ef is asking user input DO YOU Want To continue (YES/NO) for each uninstalltion.
now i want to supply YES variable when it asks for above statement .
so that i dont have to give user input from... (4 Replies)
Discussion started by: raghavendra.nsn
4 Replies
9. UNIX for Dummies Questions & Answers
Hello,
I'm new to Unix (working with OS X 10.8.5) and therefore at the beginning of my adventure. If I ask something stupid, then this is not intentional, but simple nescience. :rolleyes:
I have a problem with the redirection of text file content to echo. I was experimenting with redirection... (6 Replies)
Discussion started by: pseudo
6 Replies
10. UNIX for Dummies Questions & Answers
Can someone please explain when input redirection is necessary?
For example, "cat filename" and "cat< filename" produce the same result. I was told that if I need to bunzip a file that I should type "bunzip2<filename.bz2." However, if I omit the "<" I still get the same result. Can someone... (4 Replies)
Discussion started by: PTcharger
4 Replies
LEARN ABOUT NETBSD
mount_fdesc
MOUNT_FDESC(8) BSD System Manager's Manual MOUNT_FDESC(8)
NAME
mount_fdesc -- mount the file-descriptor file system
SYNOPSIS
mount_fdesc [-o options] fdesc mount_point
DESCRIPTION
The mount_fdesc command attaches an instance of the per-process file descriptor namespace to the global filesystem namespace. The conven-
tional mount point is /dev and the filesystem should be union mounted in order to augment, rather than replace, the existing entries in /dev.
The directory specified by mount_point is converted to an absolute path before use.
This command is normally executed by mount(8) at boot time.
The options are as follows:
-o Options are specified with a -o flag followed by a comma separated string of options. See the mount(8) man page for possible options
and their meanings.
The contents of the mount point are fd, stderr, stdin, stdout and tty.
fd is a directory whose contents appear as a list of numbered files which correspond to the open files of the process reading the directory.
The files /dev/fd/0 through /dev/fd/# refer to file descriptors which can be accessed through the file system. If the file descriptor is
open and the mode the file is being opened with is a subset of the mode of the existing descriptor, the call:
fd = open("/dev/fd/0", mode);
and the call:
fd = fcntl(0, F_DUPFD, 0);
are equivalent.
The files /dev/stdin, /dev/stdout and /dev/stderr appear as symlinks to the relevant entry in the /dev/fd sub-directory. Opening them is
equivalent to the following calls:
fd = fcntl(STDIN_FILENO, F_DUPFD, 0);
fd = fcntl(STDOUT_FILENO, F_DUPFD, 0);
fd = fcntl(STDERR_FILENO, F_DUPFD, 0);
Flags to the open(2) call other than O_RDONLY, O_WRONLY and O_RDWR are ignored.
The /dev/tty entry is an indirect reference to the current process's controlling terminal. It appears as a named pipe (FIFO) but behaves in
exactly the same way as the real controlling terminal device.
FILES
/dev/fd/#
/dev/stdin
/dev/stdout
/dev/stderr
/dev/tty
SEE ALSO
mount(2), unmount(2), tty(4), fstab(5), mount(8)
HISTORY
The mount_fdesc utility first appeared in 4.4BSD.
BUGS
This filesystem may not be NFS-exported.
BSD
March 27, 1994 BSD