Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8837263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:40:47+00:00 2026-06-14T09:40:47+00:00

I wanted to initialize a large array in bash, preferably using MATLAB style array

  • 0

I wanted to initialize a large array in bash, preferably using MATLAB style array initialization. For e.g. I want something similar to following

Declare an array with elements ranging from 0 to 1000 with the gap of 5

array=0:5:1000

I know you can achieve that in a for loop as following

for i in {0..1000..5}
do
done

But same does not work in the following case

array={0..1000..5}

syntax error: operand expected (error token is "{0..1000..5}")
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:40:48+00:00Added an answer on June 14, 2026 at 9:40 am

    In order to make an array assignment, you need to wrap the brace expansion in ().

    array=({0..1000..5})
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanted to ask about the pros cons of my the following OOP style.
I wanted to initialize a vector of pairs with something like this std::vector< std::pair<bool,
I am using the following code to initialize a model from within my controller:
I want to use CodeDOM to both declare and initialize my static field in
I was trying to create a property which is readonly. I wanted to initialize
I just wanted to know what happens behind my program when I declare and
I wanted to follow some excellent C++ advice of calculating the array length once
I wanted to see if I could initialize a vector of objects in a
I want to FTP a file, and I am using the FileInfo class for
I wanted to convert array< Byte>^ to unsigned char*. I have tried to explain

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.