Sponsored Content
Top Forums Shell Programming and Scripting what does this piece of code do? Post 302075602 by tmarikle on Monday 5th of June 2006 04:28:46 PM
Old 06-05-2006
4) No doubt that the back ticks would have been messed up in the here document and this is the easiest implementation for her. inUse is running the fuser command and returning its output into the inUse variable. Then a count is determined by using cat on a here document on the previous command's output. This is done no doubt to accomplish the tasks without creating temporary files.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

a piece of code, plz help to review

use "getopts" to get params from command. Need replace black with a specified string like "%20 DEFAULT_DELIM=%20 ... while getopts dek:f:t:vh OPTION do case $OPTION in t) DELIM=`tvar=/'"$OPTARG"'/ svar="$DEFAULT_DELIM" awk 'BEGIN{T=ENVIRON;S=ENVIRON; while(index(T,S)!=0){S=S"0"};print... (0 Replies)
Discussion started by: anypager
0 Replies

2. Shell Programming and Scripting

How to extract a piece of information from a huge file

Hello All, I need some assistance to extract a piece of information from a huge file. The file is like this one : database information ccccccccccccccccc ccccccccccccccccc ccccccccccccccccc ccccccccccccccccc os information cccccccccccccccccc cccccccccccccccccc... (2 Replies)
Discussion started by: Marcor
2 Replies

3. Shell Programming and Scripting

script or piece of code where the data returned by a stored procedure you are writing

hi fndz. Can you please help me with the code if I call a stored procedure from my shell script and stored procedure returns a cursor, cursor output should be saved to a file (3 Replies)
Discussion started by: enigma_83
3 Replies

4. Shell Programming and Scripting

Need help optimizing this piece of code (Shell script Busybox)

I am looking for suggestions on how I could possibly optimized that piece of code where most of the time is spend on this script. In a nutshell this is a script that creates an xml file(s) based on certain criteria that will be used by a movie jukebox. Example of data: $SORTEDTMP= it is a... (16 Replies)
Discussion started by: snappy46
16 Replies

5. War Stories

One time I fixed an LCD monitor with a folded piece of paper

Some of the colors weren't working on the Monitor. I found pressing around the plastic border of the screen brought them back. I opened the monitor casing and used the folded paper to put pressure against the LCD panel and housing. Wah Lah. More of a bend than a hack I guess. (2 Replies)
Discussion started by: herot
2 Replies

6. Shell Programming and Scripting

Looking for guidance (comments) on a piece of code

Hello -- I am trying to learn to do a little sed and awk scripting to search for text and numbers in text files (text processing/manipulation). My professor gave me a piece of uncommented code and I am very unfamiliar w/ the language. Can someone help me with comments so I can understand what is... (2 Replies)
Discussion started by: smithan05
2 Replies

7. Programming

what is the name of this piece of code

while ((numRead = read(inputFd, buf, BUF_SIZE)) > 0) if (write(outputFd, buf, numRead) != numRead) fatal("couldn't write whole buffer"); if (numRead == -1) errExit("read"); if (close(inputFd) == -1) errExit("close input"); if (close(outputFd) == -1) errExit("close output"); ... (1 Reply)
Discussion started by: fwrlfo
1 Replies

8. Shell Programming and Scripting

Time:Piece

Hi I am trying to find out difference between two dates with Time:Piece. I am able to get the days difference, but I want the Days as wells as hours, mins and sec difference. Below is my code for both, but the later is now working. Can anyone help me out. With only days use... (0 Replies)
Discussion started by: sauravrout
0 Replies

9. Shell Programming and Scripting

Need a piece of shell scripting to remove column from a csv file

Hi, I need to remove first column from a csv file and i can do this by using below command. cut -f1 -d, --complement Mytest.csv I need to implement this in shell scripting, Whenever i am using the above command alone in command line it is working fine. I have 5 files in my directory and... (3 Replies)
Discussion started by: Samah
3 Replies
FUSER(P)						     POSIX Programmer's Manual							  FUSER(P)

NAME
fuser - list process IDs of all processes that have one or more files open SYNOPSIS
fuser [ -cfu ] file ... DESCRIPTION
The fuser utility shall write to standard output the process IDs of processes running on the local system that have one or more named files open. For block special devices, all processes using any file on that device are listed. The fuser utility shall write to standard error additional information about the named files indicating how the file is being used. Any output for processes running on remote systems that have a named file open is unspecified. A user may need appropriate privilege to invoke the fuser utility. OPTIONS
The fuser utility shall conform to the Base Definitions volume of IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines. The following options shall be supported: -c The file is treated as a mount point and the utility shall report on any files open in the file system. -f The report shall be only for the named files. -u The user name, in parentheses, associated with each process ID written to standard output shall be written to standard error. OPERANDS
The following operand shall be supported: file A pathname on which the file or file system is to be reported. STDIN
Not used. INPUT FILES
The user database. ENVIRONMENT VARIABLES
The following environment variables shall affect the execution of fuser: LANG Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of IEEE Std 1003.1-2001, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.) LC_ALL If set to a non-empty string value, override the values of all the other internationalization variables. LC_CTYPE Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments). LC_MESSAGES Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error. NLSPATH Determine the location of message catalogs for the processing of LC_MESSAGES . ASYNCHRONOUS EVENTS
Default. STDOUT
The fuser utility shall write the process ID for each process using each file given as an operand to standard output in the following for- mat: "%d", <process_id> STDERR
The fuser utility shall write diagnostic messages to standard error. The fuser utility also shall write the following to standard error: * The pathname of each named file is written followed immediately by a colon. * For each process ID written to standard output, the character 'c' shall be written to standard error if the process is using the file as its current directory and the character 'r' shall be written to standard error if the process is using the file as its root directory. Implementations may write other alphabetic characters to indicate other uses of files. * When the -u option is specified, characters indicating the use of the file shall be followed immediately by the user name, in parenthe- ses, corresponding to the process' real user ID. If the user name cannot be resolved from the process' real user ID, the process' real user ID shall be written instead of the user name. When standard output and standard error are directed to the same file, the output shall be interleaved so that the filename appears at the start of each line, followed by the process ID and characters indicating the use of the file. Then, if the -u option is specified, the user name or user ID for each process using that file shall be written. A <newline> shall be written to standard error after the last output described above for each file operand. OUTPUT FILES
None. EXTENDED DESCRIPTION
None. EXIT STATUS
The following exit values shall be returned: 0 Successful completion. >0 An error occurred. CONSEQUENCES OF ERRORS
Default. The following sections are informative. APPLICATION USAGE
None. EXAMPLES
The command: fuser -fu . writes to standard output the process IDs of processes that are using the current directory and writes to standard error an indication of how those processes are using the directory and the user names associated with the processes that are using the current directory. RATIONALE
The definition of the fuser utility follows existing practice. FUTURE DIRECTIONS
None. SEE ALSO
None. COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. 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 Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 FUSER(P)
All times are GMT -4. The time now is 09:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy