02-08-2010
Thanks for your reply.
But when I pass them more then one(e.g in a recursive routine) it became inconvenient.
Regards,
Ziv
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I am new to unix. Is their a way to pass the output of the line below to a variable var1.
ls -1t | head -1.
I am trying something like var1=ls -1t | head -1, but I get error.
Situation is: I get file everyday through FTP in my unix box. I have to write a script that picks up first... (1 Reply)
Discussion started by: rkumar28
1 Replies
2. Shell Programming and Scripting
I have a shell script which does the encryption of a file where i am passing the file name as a command line argument,but later on the script waits on the screen to enter Y or N
what is the command i should be using on the shell script
#!/bin/bash -x
outfilename=file.out
echo... (8 Replies)
Discussion started by: rudoraj
8 Replies
3. Shell Programming and Scripting
$$$$$ (5 Replies)
Discussion started by: asirohi
5 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I have a very small requirement where i need to pass command output as an argument while invoking the shell script..
I need to call like this
sh testscript.sh ' ls -t Appl*and*abc* | head -n 1'
This will list one file name as ana argument..
I will be using "$1" in the shell... (2 Replies)
Discussion started by: pssandeep
2 Replies
5. Shell Programming and Scripting
i want to write a shell script function that will ftp the files passed in the command line . i have written a shell script for ftp but how will it do for all files passed in command line argument ,
i am passing 4 files as argument
./ftp.sh file1 file2 file3 file4
code written by me... (5 Replies)
Discussion started by: rateeshkumar
5 Replies
6. Shell Programming and Scripting
I have one working awk command line. Which taking data from the “J1202523.TXT” file and generating the “brazil.dat” file. PFB code.
awk '{ DUNS = substr($0,0,9);if ( substr($0,14,3) == "089" ) print DUNS }' J1202523.TXT > Brazil.dat
But now I want to pass two parameter as a command line argument... (4 Replies)
Discussion started by: humaemo
4 Replies
7. Programming
Hello all,
New to C and I'm trying to write a program which can run a unix command. Would like to have the option of giving the user the ability to enter arguments e.g for "ls" be able to run "ls -l".
I would appreciate any help.
Thanks
#include <stdio.h>
#include <unistd.h>
#include... (3 Replies)
Discussion started by: effizy
3 Replies
8. Shell Programming and Scripting
Hi,
I have a requirement to work on script, it should take either of arguments.
wrote it as below.
#!/bin/bash
usage() {
echo "$0: missing argument OR invalid option !
Usage : $0 -m|-r|-d
}
while getopts mrdvh opt; do
case "$opt" in
m) monitor_flag=monitor;;... (1 Reply)
Discussion started by: ramanaraoeee
1 Replies
9. Shell Programming and Scripting
I need to write a shell script, when I run that script I should pass those arguments if not, then script should not run and pass the error message like
invalid option - - should pass the argument.
and Exit from the script
https://www.unix.com/images/misc/progress.gif (1 Reply)
Discussion started by: Nsharma3006
1 Replies
10. UNIX for Dummies Questions & Answers
I need to write a shell script, when I run that script I should pass those arguments if not, then script should not run and pass the error message like
invalid option - - should pass the argument.
and Exit from the script (8 Replies)
Discussion started by: Nsharma3006
8 Replies
LEARN ABOUT OSF1
pthread_mutex_lock
pthread_mutex_lock(3) Library Functions Manual pthread_mutex_lock(3)
NAME
pthread_mutex_lock - Locks an unlocked mutex.
LIBRARY
DECthreads POSIX 1003.1c Library (libpthread.so)
SYNOPSIS
#include <pthread.h>
int pthread_mutex_lock(
pthread_mutex_t *mutex);
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
IEEE Std 1003.1c-1995, POSIX System Application Program Interface
PARAMETERS
Mutex to be locked.
DESCRIPTION
This routine locks a mutex with behavior that depends upon the type of mutex, as follows: If a normal or default mutex is specified, a
deadlock can result if the current owner of the mutex calls this routine in an attempt to lock the mutex a second time. (The deadlock is
not detected or reported.) If a recursive mutex is specified, the current owner of the mutex can relock the same mutex without blocking.
The lock count is incremented for each recursive lock within the thread. If an errorcheck mutex is specified and the current owner tries
to lock the mutex a second time, this routine reports the [EDEADLK] error. If the mutex is locked by another thread, the calling thread
waits for the mutex to become available.
Use the pthread_mutexattr_settype(3) routine to set the type of the mutex to normal, default, recursive, or errorcheck. For more informa-
tion about types of mutexes, see the desciption of pthread_mutexattr_settype(3).
The thread that has locked a mutex becomes its current owner and remains its owner until the same thread has unlocked it. This routine
returns with the mutex in the locked state and with the current thread as the mutex's current owner.
A recursive or errorcheck mutex records the identity of the thread that locks it, allowing debuggers to display this information. In most
cases, normal and default mutexes do not record the owning thread's identity.
RETURN VALUES
If an error condition occurs, this routine returns an integer value indicating the type of error. Possible return values are as follows:
Successful completion. A deadlock condition is detected. The value specified by mutex is not a valid mutex.
ERRORS
None
RELATED INFORMATION
Functions: pthread_mutexattr_settype(3), pthread_mutex_destroy(3), pthread_mutex_init(3), pthread_mutex_trylock(3), pthread_mutex_unlock(3)
Manuals: Guide to DECthreads and Programmer's Guide
delim off
pthread_mutex_lock(3)