04-12-2010
array error
hi all,
when i use array like this:
array[1]=223
echo ${array[1]}
result is :
array: 1,2: syntax error
thanx.
---------- Post updated at 09:21 AM ---------- Previous update was at 09:20 AM ----------
sorry, i had written wrongly.
when i use array like this:
array[1,2]=223
echo ${array[1,2]}
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
The following test case populate an array named: array3.
Since array1 and array2 are equal in length and values array3 will remain empty.
#!/usr/bin/ksh
test() {
set -A array1 "A"
set -A array2 "A"
NUM_1=`echo ${#array1}`
print "num elenemt in NUM_1 is ${NUM_1}"
i=1
for ELE2 in... (1 Reply)
Discussion started by: yoavbe
1 Replies
2. Shell Programming and Scripting
My code isn't pretty, my verbage isn't exact and I probably don't have all my facts together (story of my life). I know what I want with this script: to join three simple lines line 1,2,3 then repeat over and over again with 4,5,6 until the end of the file. the lines are the same, date,date,text.... (3 Replies)
Discussion started by: jseager
3 Replies
3. Shell Programming and Scripting
:) Hi,
I am assigning value to array in for loop,
here is the code:
for arg in $FILE
do
TMP=`dirname $arg`
${DIR}=$TMP
echo ${DIR}
let "i = $i + 1"
done
Here TMP gives,
d1/data/BCR
d1/data/BLM
Getting following error: (3 Replies)
Discussion started by: darshakraut
3 Replies
4. UNIX for Dummies Questions & Answers
I'm guessing i have a syntax error. I'm not sure it get's past the the while condition. I get an error 0 not found. Simple loop not sure what I'm doing wrong.
#!/usr/bin/ksh
set -A MtPtArray /u03 /u06
tUbound=${#MtPtArray
}
echo $tUbound
i=0
while ($i -lt $tUbound)
do
print... (4 Replies)
Discussion started by: KME
4 Replies
5. HP-UX
hi all!
I found a the state of disk at JA0/D13 was failed this morning.
then i replaced it this afternoon,but i run
#dsp -s
the array status displayed
====================================
STATUS
Subsystem State: 1
The Subsystem is TESTING.
The array is REBUILDING and is 87%... (0 Replies)
Discussion started by: JoyOnLine
0 Replies
6. Programming
Hello everyone.
I'm stuck with an error message that neither I nor any of my computer science peeps can understand. The program I wrote is meant to be a simple decimal to binary converter, but with this message it's more complicated than I thought.
Here's the code:
#include <iostream>... (2 Replies)
Discussion started by: qf_woodfox
2 Replies
7. Programming
Hello,
I'm experiencing a weird seg fault at run time when initializing a bi-dimensional array and initializing a class.
Please see below code and comments describing the error and the instances when it occurs and when it does not occur.
Compiled with g++ segf.cpp -o segf
output
On... (5 Replies)
Discussion started by: nmset
5 Replies
8. Shell Programming and Scripting
Have built this script, the output is what I needed, but NR 6 is omitted. Why? Is it an error? I am using Gawk.
'{nr=$2;f = $1} END{for (i=1;i<=f;i++) if (nr != i) print i, nr }' input1.csv >output1.csvinput1.csv
1 9
3 5
4 1
7 6
8 5
10 6
output1.csv > with the missing line number 6. 6 is... (5 Replies)
Discussion started by: sdf
5 Replies
9. Shell Programming and Scripting
Hi,
I need to update rows in a table based on the values in an array variable.
code is :
while read line
do
error_msg="$(echo $line)"
index=`expr $index+1`
done <"logs/$ffile"
rows_count=${#error_msg
}
i=0
while
do
echo "error msgs is... (2 Replies)
Discussion started by: RP09
2 Replies
10. Shell Programming and Scripting
awk -F'\t' -v OFS='\t' '
{ if($2 in arr) {
#print "Sahi", NR,arr
for(k=2;k<=NF;k++){
# sum]+=$2
}
}
else {
arr=NR
#print "awk",NR
for (k=3;k<=NF ; k++){
sum=$k
}
}
} (7 Replies)
Discussion started by: genome
7 Replies