Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Bad file descriptor - error with sed Post 303011511 by justo on Friday 19th of January 2018 05:58:35 AM
Old 01-19-2018
As I'm learning these things now, i'm practicing in 'https://vfsync.org/vm.html?login=1'.
This gives an online terminal to practice.
It's 'Linux'.

I tried your command, and produces same result as i got early, however without the error message.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

bad file descriptor?

Ok, I'm sure this is a total newbie question, but I think I'm in the right place, no? I'm trying to call a perl module from a cgi script - Mail::Sendmail - and my web host installed the module in a directory that doesn't seem to be accessible, at least not the way I'm trying. But I thought you... (1 Reply)
Discussion started by: ftb
1 Replies

2. UNIX for Dummies Questions & Answers

File Descriptor Help

What is a file descriptor in Unix?? How to find a file descriptor of a file in Unix?? Does it have anything to do with the Inode numbers?? (3 Replies)
Discussion started by: rahulrathod
3 Replies

3. UNIX for Advanced & Expert Users

Script to search a bad record in a file then put the record in the bad file

I need to write a script that can find a bad record (for example: there is date field colom but value provided in the file for this field is N/A) then script shoud searches this pattern and then insert the whole record into the bad file. Example: File1 Name designation dateOfJoining... (1 Reply)
Discussion started by: shilendrajadon
1 Replies

4. Shell Programming and Scripting

Script to search a bad record in a file then put the record in the bad file

I need to write a script that can find a bad record (for example: there is date field colom but value provided in the file for this field is N/A) then script shoud searches this pattern and then insert the whole record into the bad file. Example: File1 Name designation dateOfJoining... (2 Replies)
Discussion started by: shilendrajadon
2 Replies

5. Programming

utime returning -1 BAD File DEscriptor

Hi All, First of all thanks for reading this post. In my application, I am trying to create a new message queue . I am attaching the code below. mqd_t mqopen2(const char * pName, unsigned long Flags, long maxMsg, long msgSz) {... (15 Replies)
Discussion started by: parusasi
15 Replies

6. Ubuntu

ufsdump from Solaris to ubuntu fails with bad file descriptor

Hi All I have a dedicated backup server running ubuntu 10.04, which has recently been rebuilt (same OS, just different h/w) This is used to receive ufsdump output from a number of Solaris servers, using the following syntax: ufsdump 1uf :/path/to/backup/file /fs/to/be/backed/up This has... (1 Reply)
Discussion started by: in2deep
1 Replies

7. Solaris

18-Mar-2012 14:25:03.209 general: error: socket: file descriptor exceeds limit (4096/4096)

I have BIND 9.8.1-P1 cache only DNS server running in Solaris 10. I have upgraded the same from 9.6.1 to 9.8.1-P1. Now i am facing "file descriptor exceeds limit (4096/4096)" error frequently on the server. Please help me on this issue! (1 Reply)
Discussion started by: sandeep.tk
1 Replies

8. Shell Programming and Scripting

Error in the o/p says bad file descriptor...

grt=`sort -nr line_count.txt|head -1` while read $dline do if $grt" -eq "`wc -l combo_operncount.$dline|awk '{print $1}'`" ] then awk -F, '{print $1}' combo_operncount.$dline > FULLD7 else echo combo_operncount.$dline >> filecoll.txt fname=`cat filecoll.txt|tr -s "\n" " "` echo $fname... (6 Replies)
Discussion started by: nikhil jain
6 Replies

9. Solaris

Bad exchange descriptor : not able to remove files under zpool

Hi , One of my zone went down and when i booted it up i could see the pool in degraded state with some check sum errors . we have brought the pool online after scrubbing. But few files are showing this error Bad exchange descriptor Please let me know how to remove these files (2 Replies)
Discussion started by: chidori
2 Replies

10. Solaris

File System Error: BAD SUPERBLOCK AT BLOCK 16: NUMBER OF DIRECTORIES OUT OF RANGE

Hi All, we are having a file system error in one of our servers. The server failed to boot in usual user mode. Instead boot with single user mode and requesting to run a FSCK manually to repair the corrupted. see the below output. Netra T2000, No Keyboard Copyright 2008 Sun Microsystems,... (5 Replies)
Discussion started by: Buddhike G
5 Replies
GETLOGIN(3P)						     POSIX Programmer's Manual						      GETLOGIN(3P)

PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond- ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME
getlogin, getlogin_r -- get login name SYNOPSIS
#include <unistd.h> char *getlogin(void); int getlogin_r(char *name, size_t namesize); DESCRIPTION
The getlogin() function shall return a pointer to a string containing the user name associated by the login activity with the controlling terminal of the current process. If getlogin() returns a non-null pointer, then that pointer points to the name that the user logged in under, even if there are several login names with the same user ID. The getlogin() function need not be thread-safe. The getlogin_r() function shall put the name associated by the login activity with the controlling terminal of the current process in the character array pointed to by name. The array is namesize characters long and should have space for the name and the terminating null character. The maximum size of the login name is {LOGIN_NAME_MAX}. If getlogin_r() is successful, name points to the name the user used at login, even if there are several login names with the same user ID. The getlogin() and getlogin_r() functions may make use of file descriptors 0, 1, and 2 to find the controlling terminal of the current process, examining each in turn until the terminal is found. If in this case none of these three file descriptors is open to the control- ling terminal, these functions may fail. The method used to find the terminal associated with a file descriptor may depend on the file descriptor being open to the actual terminal device, not /dev/tty. RETURN VALUE
Upon successful completion, getlogin() shall return a pointer to the login name or a null pointer if the user's login name cannot be found. Otherwise, it shall return a null pointer and set errno to indicate the error. The application shall not modify the string returned. The returned pointer might be invalidated or the string content might be overwritten by a subsequent call to getlogin(). If successful, the getlogin_r() function shall return zero; otherwise, an error number shall be returned to indicate the error. ERRORS
These functions may fail if: EMFILE All file descriptors available to the process are currently open. ENFILE The maximum allowable number of files is currently open in the system. ENOTTY None of the file descriptors 0, 1, or 2 is open to the controlling terminal of the current process. ENXIO The calling process has no controlling terminal. The getlogin_r() function may fail if: ERANGE The value of namesize is smaller than the length of the string to be returned including the terminating null character. The following sections are informative. EXAMPLES
Getting the User Login Name S The following example calls the getlogin() function to obtain the name of the user associated with the calling process, and passes this information to the getpwnam() function to get the associated user database information. #include <unistd.h> #include <sys/types.h> #include <pwd.h> #include <stdio.h> ... char *lgn; struct passwd *pw; ... if ((lgn = getlogin()) == NULL || (pw = getpwnam(lgn)) == NULL) { fprintf(stderr, "Get of user information failed. "); exit(1); } APPLICATION USAGE
Three names associated with the current process can be determined: getpwuid(geteuid()) shall return the name associated with the effective user ID of the process; getlogin() shall return the name associated with the current login activity; and getpwuid(getuid()) shall return the name associated with the real user ID of the process. The getlogin_r() function is thread-safe and returns values in a user-supplied buffer instead of possibly using a static data area that may be overwritten by each call. RATIONALE
The getlogin() function returns a pointer to the user's login name. The same user ID may be shared by several login names. If it is desired to get the user database entry that is used during login, the result of getlogin() should be used to provide the argument to the getpwnam() function. (This might be used to determine the user's login shell, particularly where a single user has multiple login shells with distinct login names, but the same user ID.) The information provided by the cuserid() function, which was originally defined in the POSIX.1-1988 standard and subsequently removed, can be obtained by the following: getpwuid(geteuid()) while the information provided by historical implementations of cuserid() can be obtained by: getpwuid(getuid()) The thread-safe version of this function places the user name in a user-supplied buffer and returns a non-zero value if it fails. The non- thread-safe version may return the name in a static data area that may be overwritten by each call. FUTURE DIRECTIONS
None. SEE ALSO
getpwnam(), getpwuid(), geteuid(), getuid() The Base Definitions volume of POSIX.1-2008, <limits.h>, <unistd.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2013 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, Copyright (C) 2013 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. (This is POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Stan- dard is the referee document. The original Standard can be obtained online at http://www.unix.org/online.html . Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html . IEEE
/The Open Group 2013 GETLOGIN(3P)
All times are GMT -4. The time now is 08:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy