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 6762371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:19:01+00:00 2026-05-26T14:19:01+00:00

I am trying to compile a big project, which involves me going to different

  • 0

I am trying to compile a big project, which involves me going to different directories and compiling things there.
I have three arrays, all of them contain commands, first array contains directory traversal, second array contains compile commands, and third array contains error messages.

I set up my arrays like so

task[0]="cd vssl/make/; make clean;"
compile[0]="make all"
error[0]="echo \"We failed at vssl install\""

task[1]="cd ../../web/make/; make clean;"
compile[1]="make install"
error[1]="echo \"We failed at web install\""

Now I need a for loop that will work like this

for i in {0..$size_of_array}
do
    eval ${task[$i]}
    if (eval ${compile[$i]}); then
        echo "Done"
    else
        eval ${error[$i]}
        break
    fi
done

I have tried a lot of things, and not sure how to achieve it. for i in "${task[@]}" doesn’t work for me either because I have three variables. Would anyone have any insight on how to get around this?

Thanks to anyone who can help. 🙂

  • 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-05-26T14:19:02+00:00Added an answer on May 26, 2026 at 2:19 pm

    The size of the task array is ${#task[@]} (lovely syntax, eh?). So you can start your loop as

    for ((i=0; i<${#task[@]}; ++i))
    

    See the for command and the section on ARITHMETIC EVALUATION in bash(1) for details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to compile a rather big application on Solaris. Compiling it on
While trying to compile my project, that uses some third party headers, with mingw
I'm trying to compile a Delphi 7 project that I've inherited, and I'm getting
I'm trying to compile a program called ngrep, and when I ran configure, things
When trying to compile a project with TeamCity, I am getting an error from
I have a big project that was first created in Borland C++ 6. We're
I am trying to compile a rather large project with Borland C++ Builder 5.5.
I have very big solution, and it compiling every time I'm tring to debug.
I have a set of makefiles I use to build a 'big' C project.
Trying to compile a iPhone/iPad application with SDK3.2 and am getting this error: Undefined

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.