Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Added Two Arrays But With Errors Post 303024231 by RudiC on Thursday 4th of October 2018 08:08:49 AM
Old 10-04-2018
That happens in the last loop. You are running loop variable i one too high for the array elements (i = 4; with elements only from 0 to 3). Try
Code:
[[ $i -lt $indextotal ]]

in lieu of -le.


Run script with the xtrace (-x) option set to see what is going on.
This User Gave Thanks to RudiC For This Post:
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Adapter Errors and Link Errors

$ errpt | more IDENTIFIER TIMESTAMP T C RESOURCE_NAME DESCRIPTION 3074FEB7 0802050205 T H fscsi1 ADAPTER ERROR B8113DD1 0802050205 T H fcs1 LINK ERROR B8113DD1 0802050205 T H fcs1 LINK ERROR 3074FEB7 0802050205 T H fscsi0 ADAPTER ERROR B8113DD1 ... (0 Replies)
Discussion started by: mcastill66
0 Replies

2. AIX

Adapter Errors and Link Errors

$ errpt | more IDENTIFIER TIMESTAMP T C RESOURCE_NAME DESCRIPTION 3074FEB7 0802050205 T H fscsi1 ADAPTER ERROR B8113DD1 0802050205 T H fcs1 LINK ERROR B8113DD1 0802050205 T H fcs1 LINK ERROR 3074FEB7 0802050205 T H fscsi0 ADAPTER ERROR B8113DD1 ... (2 Replies)
Discussion started by: mcastill66
2 Replies

3. Shell Programming and Scripting

New Person Added to the Forum

Hello, I'm brand new to this forum. I am working on my first Bash shell script. We were given an exercise to get ready for the real assignment. I could use some help. The exercise is to "set two variables (i. e., file1 & file2) on the command line to the paths of the text files. We are to... (1 Reply)
Discussion started by: wcarp05
1 Replies

4. UNIX for Dummies Questions & Answers

Major OS errors/Bash errors help!!!!

Hi all, dummy here.... I have major errors on entering the shell. On login I get: -bash: dircolors: command not found -bash: tr: command not found -bash: fgrep: command not found -bash: grep: command not found -bash: grep: command not found -bash: id: command not found -bash: [: =: unary... (12 Replies)
Discussion started by: wcmmlynn
12 Replies

5. Shell Programming and Scripting

Unique value added

Guys, I am trying to get unique numbers which i can use as a primary key in a table. I tried using the <seconds_since_epoch>.<hostname> combination but since more than one process can run on the same machine at the same time, this won't be unique either. Can anyone tell me another way to do... (2 Replies)
Discussion started by: garric
2 Replies

6. Web Development

PHP arrays in arrays

PHP question... I have an SQL query that's pulled back user IDs as a set of columns. Rather than IDs, I want to use their names. So I have an array of columns $col with values 1,7,3,12 etc and I've got an array $person with values "Fred", "Bert", "Tom" etc So what I want to do is display the... (3 Replies)
Discussion started by: JerryHone
3 Replies

7. Programming

question about int arrays and file pointer arrays

if i declare both but don't input any variables what values will the int array and file pointer array have on default, and if i want to reset any of the elements of both arrays to default, should i just set it to 0 or NULL or what? (1 Reply)
Discussion started by: omega666
1 Replies

8. Programming

Arrays of strings in GFORTRAN errors

Hello I am using gfortran and I intended to do thiis: Module variables character(len=:), dimension(:), allocatable, array end module variables Sub test use variables integer (max_len) max_len=len_trim("something here") if(.not.allocated(array))... (1 Reply)
Discussion started by: pepe
1 Replies

9. AIX

LPAR cannot added disk

Dear All, I created a new partition through "Integrated Virtualization Manager" but there have an error when I added a new disk to the partition. The disk already created without any issue, Below error is to add the disk to the partition An error occured while modifying the assignments... (5 Replies)
Discussion started by: lckdanny
5 Replies
STR_SPLIT(3)								 1							      STR_SPLIT(3)

str_split - Convert a string to an array

SYNOPSIS
array str_split (string $string, [int $split_length = 1]) DESCRIPTION
Converts a string to an array. PARAMETERS
o $string - The input string. o $split_length - Maximum length of the chunk. RETURN VALUES
If the optional $split_length parameter is specified, the returned array will be broken down into chunks with each being $split_length in length, otherwise each chunk will be one character in length. FALSE is returned if $split_length is less than 1. If the $split_length length exceeds the length of $string, the entire string is returned as the first (and only) array element. EXAMPLES
Example #1 Example uses of str_split(3) <?php $str = "Hello Friend"; $arr1 = str_split($str); $arr2 = str_split($str, 3); print_r($arr1); print_r($arr2); ?> The above example will output: Array ( [0] => H [1] => e [2] => l [3] => l [4] => o [5] => [6] => F [7] => r [8] => i [9] => e [10] => n [11] => d ) Array ( [0] => Hel [1] => lo [2] => Fri [3] => end ) SEE ALSO
chunk_split(3), preg_split(3), explode(3), count_chars(3), str_word_count(3), for. PHP Documentation Group STR_SPLIT(3)
All times are GMT -4. The time now is 01:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy