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

  • Home
  • SEARCH
  • 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 7808231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:05:04+00:00 2026-06-02T03:05:04+00:00

What might be the most concise way in bash to convert a number into

  • 0

What might be the most concise way in bash to convert a number into a bitfield character string like 1101?

In effect I am trying to do the opposite of

echo $[2#1101]

Why: I need to send a parameter to a program that takes bitfields in the form of a full string like “0011010110” but often only need to enable one or few bits as in:

SUPPRESSbits=$[1<<16] runscript.sh  # OR
SUPPRESSbits=$[1<<3 + 1<<9] runscript.sh  # much more readable when I know what bits 3 and 9 toggle in the program

Then runscript.sh then sees in its env a SUPPRESSbits=65536 rather than SUPPRESSbits="1000000000000000" and ends in parse error.

  • 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-02T03:05:05+00:00Added an answer on June 2, 2026 at 3:05 am

    The easy way:

    $ dc <<<2o123p
    1111011
    
    $ bc <<<'obase=2; 123'
    1111011
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I might not like it, but the number of unofficial Android devices is growing
This seems like one of the most basic things that one might want to
I wonder what's the most effective way to render ANYTHING that might come from
This might be the most stupid thing i've ever seen, i had a broken
How might one retrieve the last element of a string array in visual basic
Most of you might have known already that godaddy does'nt have any plugins or
This might be painfully obvious to some (most?) of you, however it has been
Like most of us, I am a big fan of improving efficiency of code.
This question might seem really silly to most of the enlightened folks here. But
So what might end up being the most stupid question of the day, where

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.