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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:54:04+00:00 2026-06-17T11:54:04+00:00

for ((i=000;i<040;i++));do … From 0 to 39, there is 40 values!? … for printing

  • 0

for ((i=000;i<040;i++));do ...

From 0 to 39, there is 40 values!? … for printing from A to Z???

for ((i=000;i<040;i++));do
    printf %b "$(printf \\%03o\  $((65+0$i)))"
  done 2>/dev/null |
  xargs
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

strange!?

There is 85 values, from 70 to 154:

for ((i=0070;i<0155;i++));do
    printf %b "$(printf \\%03o\  $((19+0$i)))"
  done 2>/dev/null |
    xargs
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Dummy request (about error handling)! Don’t re-open this!! ;-p

Answer

As this question was closed, no answer could be added, so there is my explanation:

The missunderstanding is done by the (ab)use of 2>/dev/null!!

So, simply dropping this will output:

for ((i=000;i<040;i++));do
    echo -e $(eval "printf "\\\\%04o" $((65+0$i)) ")
done  |   xargs
bash: 65+08: value too great for base (error token is "08")
bash: 65+09: value too great for base (error token is "09")
bash: 65+018: value too great for base (error token is "018")
bash: 65+019: value too great for base (error token is "019")
bash: 65+028: value too great for base (error token is "028")
bash: 65+029: value too great for base (error token is "029")
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Things become more clear!!

We could count error lines by using wc -l:

for ((i=000;i<040;i++));do
    echo -e $(eval "printf "\\\\%04o" $((65+0$i)) ")
done 2> >(wc -l >&2) |   xargs
6
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

There are 6 error lines, because of illegal digit 8 or 9 in octal numbers.

So if this is octal, then you could either

printf %d\\n 040

or

echo $(( 040 ))

or

echo $(( 8#40 ))

to convert 040 octal to 32 decimal (4 * 8 + 0 = 32).

Then having 32 operation with 6 errors dropped, there are finally 26 outputs.

With wc -l again:

for ((i=0070;i<0155;i++));do
    echo -e $(eval "printf "\\\\%04o" $((19+0$i)) ")
  done 2> >(wc -l >&2) | xargs 
27
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

There are in fact 27 errors, with values from…

printf "%d\n" 0070 0155
56
109

From 56 to 108! There is not 85 values, but 53!!

echo $(( 155 - 70 ))  $(( 0155 - 070 ))  $(( 109 - 56 ))
85 53 53

Again: 53 operations with 27 errors = 26 outputs

echo $((53-27))
26

Yes!

This is the right number of letters (in the alphabet I know)!

Conclusion

The question could be rewritten as:

How abuse of /dev/null could make strange behaviours

So be carefull when redirecting STDERR! Avoid simply redirecting STDERR to /dev/null:

command 2>/dev/null

And prefer to use commands like:

command 2> >(grep -v "unwanted message" >&2)
  • 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-17T11:54:05+00:00Added an answer on June 17, 2026 at 11:54 am

    You are simply using octal numbers, as your numbers are prefixed by 0.

    So it’s base 8, not base 10.

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

Sidebar

Related Questions

We have a 2,000,000 lines of code application in Mercurial. Obviously there is a
Suppose there are ~10,000's of keys, where each key corresponds to a stream of
I've got 80,000 users on my site and i've recently turned away from the
There is a 100,000-character text that need to be displayed. If I put it
I have 16,000 jpg's from a webcan screeb grabber that I let run for
200,000,000 is much less than the maximum 32-bit INTEGER, 2,147,483,647.
20120315021529.000[-8:PST] to get the first part I was able by using below C# code.
I need about 1,000 words to be able to be accessed constantly by my
I have a 500,000 line SQL script: UPDATE users SET region_id = 9814746 WHERE
I have like 12,000 rows in a DataTable and it is timing out when

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.