Sponsored Content
Top Forums Shell Programming and Scripting Assign dscl output to variable as an array Post 302374880 by macnetdaemon on Wednesday 25th of November 2009 06:11:13 PM
Old 11-25-2009
Frans,

It works. I got the result as a single string that I can now parse through and insert into an array.

Many thanks
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to assign an output to a variable

Hi, I am giving a grep command, and i am getting the output. i want to store it in a variable for eg a = grep '12345' /dir/1/2/log.txt ( the output is number) b= grep 'basic' /dir/1/2/log1.txt (in this case the output is character) so how to assign the output of grep to a variable ... (1 Reply)
Discussion started by: vasikaran
1 Replies

2. Shell Programming and Scripting

hot to assign output to a variable

I want to assign a comment to a veriable for example my program head -1 myfile I want to assıgn output to a variable (1 Reply)
Discussion started by: walnut
1 Replies

3. Shell Programming and Scripting

how to assign the output of the interective script to the variable

Hi, I work in ksh88. I have an interective script which prompts the user for the input and returns numeric value depending on the input provided. I need to call this script inside another script and then assign the resulting output the the variable. The call like that A=`my script` obviously... (6 Replies)
Discussion started by: aoussenko
6 Replies

4. Shell Programming and Scripting

How to assign a variable to an array

I want to ask the user to enter an X amount of file names. I want to put those names into an array and then loop back through them to verify they are in the directory. 1st- How would I assign the value to an array and what is the correct syntax. 2nd- how would i reference that array after I... (3 Replies)
Discussion started by: tvb2727
3 Replies

5. Shell Programming and Scripting

assign value to array variable

Hi, I have a piece of code as follows: i=0 while read LINE do var = "$LINE" i=$((i+1)) echo "${var}" done < file I want to assign value to the array var. However, when i execute the script i get a error. Please can you help me know what i am missing. I ultimately want to... (2 Replies)
Discussion started by: sunrexstar
2 Replies

6. Shell Programming and Scripting

How to assign an array element to a variable

Hi every one.. I'm new to shell scripting... I would like to assign a single array element to a variable... Is it possible to do it.... Could any body help me.... (3 Replies)
Discussion started by: kaushik_87
3 Replies

7. Shell Programming and Scripting

how to assign file names to array variable?

I wish to assign file names with particular extention to array variables. For example if there are 5 files with .dat extention in /home/sam then i have to assign these 5 files to an array. plz help me how to accomplish this. Thanks in advance. (4 Replies)
Discussion started by: siteregsam
4 Replies

8. Shell Programming and Scripting

awk assign output of array to specific field-number

With this script i want to print the output to a specific field-number . Can anybody help? awk 'NR=FNR{split(FILENAME,fn,"_");nr=$2;f = $1} END{for (i=1;i<=f;i++) print i,$fn=nr}' input_5.csv input_6.csvinput_5.csv 4 135 5 185 6 85 11 30input_6.csv 1 90 3 58 4 135 7 60 8 55 10... (1 Reply)
Discussion started by: sdf
1 Replies

9. Shell Programming and Scripting

How can we assign value to an array variable from an external file?

is it possible to assign value to an array variable from an external file?? if yes then how?? I am using below code but its not working. #!bin/bash myarray < file_name echo ${mayarray} (6 Replies)
Discussion started by: mukulverma2408
6 Replies

10. Shell Programming and Scripting

Assign output to dynamic variable

Hi Folks, I am trying to assign a value from the command to a dynamic variable. But I am not getting the desired output.. I am sure something is wrong so i need experts advise. There will be multiple files like /var/tmp/server_1, /var/tmp/server_2, /var/tmp/server_3, having different server... (6 Replies)
Discussion started by: ganga.dharan
6 Replies
MONGODB.LASTERROR(3)							 1						      MONGODB.LASTERROR(3)

MongoDB::lastError - Check if there was an error on the most recent db operation performed

SYNOPSIS
public array MongoDB::lastError (void ) DESCRIPTION
This method is equivalent to: <?php public function lastError() { return $this->command(array('getlasterror' => 1)); } ?> PARAMETERS
This function has no parameters. RETURN VALUES
Returns the error, if there was one. EXAMPLES
Example #1 MongoDB.lastError(3) NULL error example <?php $db->resetError(); var_dump($db->lastError()); ?> The above example will output something similar to: array(3) { ["err"]=> NULL ["n"]=> int(0) ["ok"]=> float(1) } Example #2 MongoDB.lastError(3) duplicate key example <?php $c = $db->selectCollection("foo"); // insert two documents with the same _id $c->insert(array("_id" => 1)); $c->insert(array("_id" => 1)); var_dump($db->lastError()); ?> The above example will output something similar to: array(3) { ["err"]=> string(64) "E11000 duplicate key errorindex: foo.foo.$_id_ dup key: { : 1 }" ["n"]=> int(0) ["ok"]=> float(1) } PHP Documentation Group MONGODB.LASTERROR(3)
All times are GMT -4. The time now is 11:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy