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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:30:57+00:00 2026-06-05T02:30:57+00:00

Question below the code. #!/bin/sh check() { dir=$1 chsum1=`find ~/folder -type f -exec cat

  • 0

Question below the code.

#!/bin/sh

check() {   
    dir="$1"
    chsum1=`find ~/folder -type f -exec cat {} \; | md5` 
    chsum2=$chsum1

    for (( ; 0x$chsum1 == 0x$chsum2;  ))
    do
        echo "hello"
        sleep 10
        chsum2=`find ~/folder -type f -exec cat {} \; | md5`
    done

echo "hello"
#eval $2
}

check $*

The goal is: Make the code works. What it does? Applies md5 to a folder, then compare the md5 values. It maintains a loop until the value is different (that means something on the folder happened), thus after 10 secs when the md5 calculates the hash it should be different, then the code ends.

Two Questions.

  1. Notice that there is a commented while there. If you uncomment the while and comment the for, you will notice the code stops working. Why? I tried different combinations for trying to make it work. I enclosed with quotes, used -eq, =, ==, etc. None worked. How could I make it work with a whole?
  2. The way the code it is now, if it is run then what I get as output is:

((: d41d8cd98f00b204e9800998ecf8427e == 97329acaae00bdf66e30ac53b49e1036: value too great for base (error token is “97329acaae00bdf66e30ac53b49e1036”)

Thus, how can I fix this is the second question and why this is happening.

Thank you!

  • 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-05T02:30:58+00:00Added an answer on June 5, 2026 at 2:30 am

    The issue you are having with the (updated) posted code is that you are using a for loop when a while loop works.

    The following code works for me. I simply changed the for loop to a while loop.

    #!/bin/sh
    
    check() {
            dir="$1"
            chsum1=`find ~/NASAtest -type f -exec cat {} \; | md5`
            chsum2=$chsum1
    
            while [ $chsum1 == $chsum2 ]
            do
                    echo "hello"
                    sleep 10
                    chsum2=`find ~/NASAtest -type f -exec cat {} \; | md5`
            done
    
            echo "hello"
            #eval $2
    }
    
    check $*
    

    The reason the while loop wasn’t working is because you were missing spaces between the square brackets and the expression.

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

Sidebar

Related Questions

The below code is datatable and based on Qustion type (property of Question object)
I have a question and below is my code. class A { int i=10;
Edit: original question below, but I revise it now that I have some code
I have a basic question about the form action. Consider the below code here,
I am using Polymorphic Models . Simple Question: My code below works without using
My code below is supposed to display each question ($_POST[questionText]). For each question, it
I have a basic PHP question, take the code below for example, let's say
Not sure if I'm phrasing my question right, but I have the code below.
I've got a simple question but it has got me confounded. The code below
Ok another question in VHDL. Below is my code. Suppose that I want my

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.