Sponsored Content
Full Discussion: Deciphering the Code
Top Forums UNIX for Dummies Questions & Answers Deciphering the Code Post 302318158 by jim mcnamara on Thursday 21st of May 2009 12:53:01 AM
Old 05-21-2009
If the argument count ($#) is less than (-lt) 1

Is is that what you meant?
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help deciphering script

There are files on a remote server with the file name ending in "mm-dd-yy.txt". The script I am running is: mls "Daily_Service_Text_File_*" /my/local/dir/Filelisting.txt nawk -F_ -f file.awk /my/local/dir/Filelisting.txt | sort -k1n | cut -f2- | tail -1 It worked up too "12-31-07.txt" but... (3 Replies)
Discussion started by: bbbngowc
3 Replies

2. Shell Programming and Scripting

Help deciphering FTP get perl script

I found this very useful perl script that will check a remote ftp server, search for files of a specific time and get them. When I run the script it works, but it gave me the following error: Couldn't get filename_12-13-07.txt Bad file number What in this script would cause this? I know... (2 Replies)
Discussion started by: bbbngowc
2 Replies

3. Shell Programming and Scripting

Deciphering strings or variable values

Hi, I have a script at the moment of which reads in simply what the latest version is within a folder i.e. v001, v002, v003 etc and then stores this latest version in a variable i.e. $LATEST would echo v003. I have then cut this string so that I only consider the 003 part. I would then like to... (3 Replies)
Discussion started by: cyberfrog
3 Replies

4. UNIX for Dummies Questions & Answers

Need help deciphering this

I'm reading about command substitutions and came across this little function in my book: function lsd { date=$1 ls -l |grep -i "^.\{42\}$date"|cut -c55- } it's a little example which is supposed to select files by modification date, given as an argument to the function. I... (3 Replies)
Discussion started by: Straitsfan
3 Replies

5. Programming

Some help with Perl please (deciphering)

I am trying to simplify the coding in a script I was given, but it was written 7-10 years ago and is pretty complicated. below is a tidbit, if someone can break it down for me I would appreciate it. sub ParseText { my ($line, $key, $value, $sub, $script); foreach $line (@_)... (0 Replies)
Discussion started by: callyvan
0 Replies

6. Shell Programming and Scripting

need help deciphering this if statement

I'm going through my bash book and came across this if statment. if *$)" ]; then the book says that the grep expression means "an initial dash followed by a digit" (which I understand) "optionally followed by one or more digits" That's the part I can't figure out -- I know the * is a... (8 Replies)
Discussion started by: Straitsfan
8 Replies

7. Programming

Deciphering a tag character string

I have a string, eg 7f30.3 and I want to store things in the following way npos = 7 decform = true width = 30 ndp = 3 I need to read each character one by one. I am coding in fortran but I can try to code it should answer be given in C in the above way. (2 Replies)
Discussion started by: kristinu
2 Replies

8. UNIX for Beginners Questions & Answers

Deciphering AWK code

Dear experts, I am a relative novice in the Unix and came across a very useful code that I regularly use for my research blindly. I am wondering if any of the professional members could kindly briefly explain to me what the code actually does? Many thanks in advance The script is awk... (4 Replies)
Discussion started by: arsalane
4 Replies
_lwp_sema_wait(2)						   System Calls 						 _lwp_sema_wait(2)

NAME
_lwp_sema_wait, _lwp_sema_trywait, _lwp_sema_init, _lwp_sema_post - semaphore operations SYNOPSIS
#include <sys/lwp.h> int _lwp_sema_wait(lwp_sema_t *sema); int _lwp_sema_trywait(lwp_sema_t *sema); int _lwp_sema_init(lwp_sema_t *sema, int count); int _lwp_sema_post(lwp_sema_t *sema); DESCRIPTION
Conceptually, a semaphore is an non-negative integer count that is atomically incremented and decremented. Typically this represents the number of resources available. The _lwp_sema_init() function initializes the count, _lwp_sema_post() atomically increments the count, and _lwp_sema_wait() waits for the count to become greater than 0 and then atomically decrements it. LWP semaphores must be initialized before use. The _lwp_sema_init() function initializes the count associated with the LWP semaphore pointed to by sema to count. The _lwp_sema_wait() function blocks the calling LWP until the semaphore count becomes greater than 0 and then atomically decrements it. The _lwp_sema_trywait() function atomically decrements the count if it is greater than zero. Otherwise it returns an error. The _lwp_sema_post() function atomically increments the semaphore count. If there are any LWPs blocked on the semaphore, one is unblocked. RETURN VALUES
Upon successful completion, 0 is returned. A non-zero value indicates an error. ERRORS
The _lwp_sema_init(), _lwp_sema_trywait(), _lwp_sema_wait(), and _lwp_sema_post() functions will fail if: EINVAL The sema argument points to an invalid semaphore. EFAULT The sema argument points to an illegal address. The _lwp_sema_wait() function will fail if: EINTR The function execution was interrupted by a signal or fork(2). The _lwp_sema_trywait() function will fail if: EBUSY The function was called on a semaphore with a zero count. The _lwp_sema_post() function will fail if: EOVERFLOW The value of the sema argument exceeds SEM_VALUE_MAX. SEE ALSO
fork(2) SunOS 5.10 8 May 1998 _lwp_sema_wait(2)
All times are GMT -4. The time now is 11:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy