Sponsored Content
Top Forums Shell Programming and Scripting Problems with variables syntax Post 302631277 by asterisk-ix_use on Friday 27th of April 2012 07:16:38 AM
Old 04-27-2012
Try creating an array instead of multiple variables like proc0,proc1..etc

Code:
 
val=0
for i in ${array[*]}
do
    proc_output[$val]="$(ls -ld /proc/$i)" 
    ((val++))
done

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Problems with sed and flat file variables

Hello All, It has been a loooooooooooong time since I had last used sed but decided to use it for a simple task I have . My goal is to use sed to read variables from a flat file then use those same variables in order to make some subsitutions. However what I am finding is that when the... (1 Reply)
Discussion started by: icalderus
1 Replies

2. Shell Programming and Scripting

syntax for variables in sed

I always kind of wondered this but I have a variable that I want to use in a search and replace. Basically I want to search a file for the string in my variable and replace it with something fixed but I'm unsure of the variable rule in sed. Here's generally what I have: sed 's/$name/newname/g'... (15 Replies)
Discussion started by: eltinator
15 Replies

3. Shell Programming and Scripting

Problems with syntax in a loop (AWK)

Hi guys, I'm trying to loop through a number of files that is set by whatever is in a field. eg. The idea is to split FILELIST down into fields, it could contain 1 - 999 fields and it's bar delimited. I thought simple, count the number of fields in the field and then loop... (1 Reply)
Discussion started by: Peejay
1 Replies

4. Shell Programming and Scripting

problems calling out variables in a loop

good afternoon forums. i have a problem that ive been trying to work out all morning and cant seem to get my head around it. what i have in my script is individual letters saved in different variables. so if the word unix was saved then 'u' would be stored in the variable 'wvar1' 'n' in 'wvar2'... (7 Replies)
Discussion started by: strasner
7 Replies

5. Shell Programming and Scripting

Problems with Syntax

I'm an experienced programmer that is new to shell scripting. I'm putting together a shell script that erases all files of a certain age. These files are in directories provided on lines of a file that is provided via command line argument and takes any errors(permissions, etc) and emails them to a... (3 Replies)
Discussion started by: drew2002
3 Replies

6. Shell Programming and Scripting

Shell variables problems

hi, i need some help, the situation is this 1-file of variable enviroments DIR1=/tmp DIR2=otherdir/mydir 2-file of list of files (all the names references whic variables of first point) ${DIR1}/${DIR2}/onefile Well now i create a shell script whic... (5 Replies)
Discussion started by: chipcmc
5 Replies

7. Shell Programming and Scripting

Problems with expect and set variables

I'm writing a script that'll send a time-stamp to my backup server. I create a file with the name of the current date, send it to my server with scp and rm the file from the local computer. Individually these commands work fine and with a set name the expect scripts also work fine. The problem... (0 Replies)
Discussion started by: Ktesh564
0 Replies

8. Shell Programming and Scripting

Syntax to see if two variables match

I have a simple shell script to read create a mysql database as a particular user. Right now, I have the password set as a variable to make sure someone does not mistype the password. I want to take the hard coded password out of the file and make the user input the password twice to make they... (2 Replies)
Discussion started by: bouncer
2 Replies

9. Shell Programming and Scripting

EVAL syntax problems

Hi there As part of a larger script I need to put the output of an ls into a variable which has an incremental number. ie nathan@nathan-Vostro-1700:~$ eval 'proc'$val='`ls -ld /proc/9467`' nathan@nathan-Vostro-1700:~$ echo $proc0 dr-xr-xr-x 8 nathan nathan 0 2012-05-02 09:21... (3 Replies)
Discussion started by: nathan.harris
3 Replies

10. Shell Programming and Scripting

Problems with substitution between two variables

To all geeks, What I want to achieve: 1. Accept two filenames from user and store the filenames in two variables (FILE1 and FILE2) 2. Check if files exisits. If doesn't, then exit 3. If files exist, look for a particular string in both files 4. If the string exists, then change the... (8 Replies)
Discussion started by: Deepak Tulsani
8 Replies
nvpair_value_byte(9F)					   Kernel Functions for Drivers 				     nvpair_value_byte(9F)

NAME
nvpair_value_byte, nvpair_value_nvlist, nvpair_value_int8, nvpair_value_int16, nvpair_value_int32, nvpair_value_int64, nvpair_value_uint8, nvpair_value_uint16, nvpair_value_uint32, nvpair_value_uint64, nvpair_value_string, nvpair_value_boolean_array, nvpair_value_byte_array, nvpair_value_nvlist_array, nvpair_value_int8_array, nvpair_value_int16_array, nvpair_value_int32_array, nvpair_value_int64_array, nvpair_value_uint8_array, nvpair_value_uint16_array, nvpair_value_uint32_array, nvpair_value_uint64_array, nvpair_value_string_array - retrieve value from a name-value pair SYNOPSIS
#include <sys/nvpair.h> int nvpair_value_boolean_value(nvpair_t *nvpair, boolean_t *val); int nvpair_value_byte(nvpair_t *nvpair, uchar_t *val); int nvpair_value_int8(nvpair_t *nvpair, int8_t *val); int nvpair_value_uint8(nvpair_t *nvpair, uint8_t *val); int nvpair_value_int16(nvpair_t *nvpair, int16_t *val); int nvpair_value_uint16(nvpair_t *nvpair, uint16_t *val); int nvpair_value_int32(nvpair_t *nvpair, int32_t *val); int nvpair_value_uint32(nvpair_t *nvpair, uint32_t *val); int nvpair_value_int64(nvpair_t *nvpair, int64_t *val); int nvpair_value_uint64(nvpair_t *nvpair, uint64_t *val); int nvpair_value_string(nvpair_t *nvpair, char **val); int nvpair_value_nvlist(nvpair_t *nvpair, nvlist_t **val); int nvpair_value_boolean_array(nvpair_t *nvpair, boolean_t **val, uint_t *nelem); int nvpair_value_byte_array(nvpair_t *nvpair, uchar_t **val, uint_t *nelem); int nvpair_value_int8_array(nvpair_t *nvpair, int8_t **val, uint_t *nelem); int nvpair_value_uint8_array(nvpair_t *nvpair, uint8_t **val, uint_t *nelem); int nvpair_value_int16_array(nvpair_t *nvpair, int16_t **val, uint_t *nelem); int nvpair_value_uint16_array(nvpair_t *nvpair, uint16_t **val, uint_t *nelem); int nvpair_value_int32_array(nvpair_t *nvpair, int32_t **val, uint_t *nelem); int nvpair_value_uint32_array(nvpair_t *nvpair, uint32_t **val, uint_t *nelem); int nvpair_value_int64_array(nvpair_t *nvpair, int64_t **val, uint_t *nelem); int nvpair_value_uint64_array(nvpair_t *nvpair, uint64_t **val, uint_t *nelem); int nvpair_value_string_array(nvpair_t *nvpair, char ***val, uint_t *nelem); int nvpair_value_nvlist_array(nvpair_t *nvpair, nvlist_t ***val, uint_t *nelem); INTERFACE LEVEL
Solaris DDI specific (Solaris DDI) PARAMETERS
nvpair Name-value pair (nvpair) to be processed. nelem Address to store the number of elements in value. val Address to store the value or starting address of array value. DESCRIPTION
These functions retrieve the value of nvpair. The data type of nvpair must match the function name for the call to be successful. There is no nvpair_value_boolean(); the existence of the name implies the value is true. For array data types, including string, the memory containing the data is managed by the library and references to the value remains valid until nvlist_free() is called on the nvlist_t from which nvpair is obtained. See nvlist_free(9F) The value of an nvpair may not be retrieved after the nvpair having been removed from or replaced in an nvlist. Replacement can happen dur- ing pair addition on nvlists created with NV_UNIQUE_NAME_TYPE and NV_UNIQUE_NAME. See nvlist_alloc(9F) for more details. RETURN VALUES
0 Success EINVAL Either one of the arguments is NULL or type of nvpair does not match the interface name. CONTEXT
These functions can be called from user or interrupt context. SunOS 5.10 2 Feb 2004 nvpair_value_byte(9F)
All times are GMT -4. The time now is 04:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy