Sponsored Content
Full Discussion: bash shell script
Top Forums Shell Programming and Scripting bash shell script Post 38998 by Perderabo on Saturday 2nd of August 2003 03:38:07 PM
Old 08-02-2003
A function can be passed arguments. Your code is going to carefully examine the arguments passed to check_ops when it was invoked. Apparently you aren't passing any arguments to check_ops.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

need help with bash shell script

Hi guys! I have just started with shell programming!! I am having pronblem with variable subsitutuion. when i do egrep "*" marks this will give me the pattern match. but how can i catch the output of that result in a variable. if i say result = egrep "*" marks it gives me syntax... (2 Replies)
Discussion started by: vmtailor
2 Replies

2. UNIX for Dummies Questions & Answers

Bash shell script

Hi Guys, I am trying to alter a script for my company. I need the start of it to go something like this. User is asked to input 8 numbers 8 numbers are written to a txt file ***** ***** ***** txt file is read ***** ***** The text file gets read in between other files represented by... (2 Replies)
Discussion started by: outthere_3
2 Replies

3. Shell Programming and Scripting

Bash Shell script--need help

Hi all, i am beginner to unix and trying out a shell script which does the following. i have to calculate a persons salary. his salary is read from the keyboard. he has two types of deductions. 40% as dearness allowance and 20% as house rent. i have to print the gross salary. here is the code... (5 Replies)
Discussion started by: Irishboy24
5 Replies

4. Shell Programming and Scripting

Bash shell script- help

I need to invoke a program on remote server using ssh in a shell script. In addition i would like to capture date/time and if there is any errors , then script should write to log file. can someone please help me out? (1 Reply)
Discussion started by: sam101
1 Replies

5. Shell Programming and Scripting

Help with bash shell script

Hi, I have a file in which records contains non ascii characters. The records are comma delimited and quoted. The non ascii characters are found in a particular column. Example records "YY","AK000021","Ã","IO","PP" "Y1","AK000022","Ã","PO","PP" "Y2","AK000022","Ã","PO","PP" I need to... (2 Replies)
Discussion started by: akshu.agni
2 Replies

6. Shell Programming and Scripting

Bash Shell Script

HELP!My program ends after entering one choice---need help making it take multiple inputs,instead of terminating after displaying just one #!/bin/bash# Crude address databaseclear # Clear the screen.echo " Contact List"echo " ------- ----"echo "Choose one of the following... (6 Replies)
Discussion started by: help123
6 Replies

7. Shell Programming and Scripting

Bash shell script to check if script itself is running

hi guys we've had nagios spewing false alarm (for the umpteenth time) and finally the customer had enough so they're starting to question nagios. we had the check interval increased from 5 minutes to 2 minutes, but that's just temporary solution. I'm thinking of implementing a script on the... (8 Replies)
Discussion started by: hedkandi
8 Replies

8. Shell Programming and Scripting

Need help with bash shell script

I need to create digit day script that takes a single numeric argument and then it should print out the day of the week using the number modulo 7 formula e.g: 0 - Sunday 6- Saturday 131 - Friday I am fairly new to unix so I don't know how to use the number modulo 7 formula. Does the script need... (3 Replies)
Discussion started by: lukefrost96
3 Replies

9. Shell Programming and Scripting

Different behavior between bash shell and bash script for cmd

So I'm trying to pass certain json elements as env vars and use them later on in a script. Sample json: JSON='{ "Element1": "file-123456", "Element2": "Name, of, company written in, a very weird way", "Element3": "path/to/some/file.txt", }' (part of the) script: for s... (5 Replies)
Discussion started by: da1
5 Replies

10. UNIX for Beginners Questions & Answers

In Bash shell - the ps -ef shows only the /bin/bash but the script name is not displayed

In Bash shell - the ps -ef shows only the /bin/bash but the script name is not displayed ? Is there any way to get the script names for the process command ? --- Post updated at 08:39 AM --- in KSH (Korn Shell), my command output shows the script names but when run in the Bash Shell... (3 Replies)
Discussion started by: i4ismail
3 Replies
va_arg(9F)						   Kernel Functions for Drivers 						va_arg(9F)

NAME
va_arg, va_start, va_copy, va_end - handle variable argument list SYNOPSIS
#include <sys/varargs.h> void va_start(va_list pvar, void parmN); (type *) va_arg(va_list pvar, type); void va_copy(va_list dest, va_list src); void va_end(va_list pvar); INTERFACE LEVEL
Solaris DDI specific (Solaris DDI). PARAMETERS
va_start() pvar Pointer to variable argument list. name Identifier of rightmost parameter in the function definition. va_arg() pvar Pointer to variable argument list. type Type name of the next argument to be returned. va_copy() dest Destination variable argument list. src Source variable argument list. va_end() pvar Pointer to variable argument list. DESCRIPTION
This set of macros allows portable procedures that accept variable argument lists to be written. Routines that have variable argument lists but do not use the varargs() macros are inherently non-portable, as different machines use different argument-passing conventions. Routines that accept a variable argument list can use these macros to traverse the list. va_list is the type defined for the variable used to traverse the list of arguments. va_start() is called to initialize pvar to the beginning of the variable argument list. va_start() must be invoked before any access to the unnamed arguments. The parameter name is the identifier of the rightmost parameter in the variable parameter list in the function defi- nition (the one just before the ", ..."). If this parameter is declared with the register storage class or with a function or array type, or with a type that is not compatible with the type that results after application of the default argument promotions, the behavior is undefined. va_arg() expands to an expression that has the type and value of the next argument in the call. The parameter pvar must be initialized by va_start(). Each invocation of va_arg() modifies pvar so that the values of successive arguments are returned in turn. The parameter type is the type name of the next argument to be returned. The type name must be specified in such a way that the type of pointer to an object that has the specified type can be obtained by postfixing a * to type. If there is no actual next argument, or iftype is not compatible with the type of the actual next argument (as promoted according to the default argument promotions), the behavior is undefined. The va_copy() macro saves the state represented by the va_list src in the va_list dest. The va_list passed as dest should not be initial- ized by a previous call to va_start() It then must be passed to va_end() before being reused as a parameter to va_start() or as the dest parameter of a subsequent call to va_copy(). The behavior is undefined if any of these restrictions are not met. The va_end() macro is used to clean up. It invalidates pvar for use (unless va_start() is invoked again). Multiple traversals, each bracketed by a call to va_start() and va_end(), are possible. EXAMPLES
Example 1: Creating a Variable Length Command The following example uses these routines to create a variable length command. This might be useful for a device that provides for a vari- able-length command set. ncmdbytes is the number of bytes in the command. The new command is written to cmdp. static void xx_write_cmd(uchar_t *cmdp, int ncmdbytes, ...) { va_list ap; int i; /* * Write variable-length command to destination */ va_start(ap, ncmdbytes); for (i = 0; i < ncmdbytes; i++) { *cmdp++ = va_arg(ap, uchar_t); } va_end(ap); } SEE ALSO
vcmn_err(9F), vsprintf(9F) NOTES
It is up to the calling routine to specify in some manner how many arguments there are, since it is not always possible to determine the number of arguments from the stack frame. Specifying a second argument of char or short to va_arg makes your code non-portable, because arguments seen by the called function are not char or short. C converts char and short arguments to int before passing them to a function. SunOS 5.10 21 Feb 1996 va_arg(9F)
All times are GMT -4. The time now is 09:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy