# Super Speedy Hexadecimal or Octal Calculations and Conversions to Decimal.

echo "\$(( 0x10 )) - \$(( 010 )) = \$(( 0x10 - 010 ))"
^Hexadecimal Ten minus Octal Ten is Eight(in Decimal). `echo "\$(( 0xaf )) = \$(( 0257 ))"` ^Hexadecimal AF and Octal 257 are both Decimal 175.
Sample Output
```16 - 8 = 8

175 = 175```

10
2009-06-08 19:35:53

### What Others Think

The basic point here is that (I'm assuming bash) the shell understands hexadecimal and octal numbers, when strings of digits (0-9,a-f) are preceded by 0x or 0.
bwoodacre · 796 weeks and 3 days ago
That's excellent, which I knew about it sooner!
nanreh · 796 weeks and 3 days ago
Yes, the general idea is that BASH's \$(( ... )) construct accepts hex with "0x" and *ASSUMES* numbers with leading zeros are octal. This assumption can cause weird bugs when scripting; especially when time and dates are involved. This produces an error only in the months of August and September: `currentmonth=\$( date +%m )` `echo "There are \$(( 12 - currentmonth )) months left in the year."`
asmoore82 · 796 weeks and 2 days ago
After some googling, it seems you can force a particular base on an expression via prefixing "base#" to a number. In august/september 'date +%m' will yield 08 and 09, so to fix this the echo would read: `echo "There are \$(( 12 - 10#currentmonth )) months left in the year."` to force current month to be interpreted in base 10. Obviously the base must be specified in base 10, although it would be an interesting way to screw up somebody's bash session (if it were possible) to change the default number base. :-)
bwoodacre · 794 weeks and 3 days ago
I have learned a lot of amazing content from this site and it is good. I just came across content on signnow.com/features/add-wet-ink-signature-online. I didn’t know about this feature.
seoexpert · 100 weeks and 1 day ago
Great post i must say and thanks for the information. Education is definitely a sticky subject. However, is still among the leading topics of our time. I appreciate your post and look forward to more. Cleaning
seoexpert · 99 weeks ago
I have been searching to find a comfort or effective procedure to complete this process and I think this is the most suitable way to do it effectively. smm panel
seoexpert · 98 weeks and 5 days ago
Since 2008, Perfect House Pug Puppies has been the leading Pug puppy breeder in the US, providing premium Pug puppies for sale. Each puppy exhibits the professionalism and knowledge that have set Perfect House Pug puppies apart from other pug puppy breeders. The professionals at Perfect House Pug Puppies are dedicated about finding their puppies loving, beloved homes where they can enjoy long, healthy lives. A companion that has been produced for quality, health, and temperament that satisfies the breed standard is guaranteed by Perfect House Pug puppies, the pug breeder that has set the benchmark for exceptional customer satisfaction. If you are looking to buy a baby pug, Black and white pugs, Mini pug puppies for sale, Black and tan pug for sale, Teacup pug puppies for sale, Female pug puppies, pug puppies for sale, pug puppies for sale near me, pug puppies for sale under \$500 near me. Pug Puppies for Sale Near Me pugs puppies for sale teacup pugs for sale pug puppies for sale by owner pug puppies ohio PUG PUPPY FOR SALE NEAR ME PUG PUPPIES FOR SALE pug puppies for sale in kentucky Pug Puppies for Sale Under \$500 Near Me pug puppies for sale in texas pug puppies for sale \$200 pugs for sale near me under \$500 pugs for sale under \$400 near me pugs for sale near me puppies for sale near me under \$500 pug puppies for sale under \$1,000 near me pug for sale pug puppies for sale under \$300 Brindle Pug Pitbull Pug Mix Pugs for sale cheap Cheap pug affordable pug puppies for sale near me black pugs for sale near me White Pugs for sale pug dog for sale free pug puppies pug puppies for sale in my area mn pug breeders pug puppies indiana pugs for sale michigan PUG PUPPY ADOPTION Pug puppies for sale Pug puppies for sale near me Pug puppies near me Pug Puppies for Sale Under \$500 Near Me Cute Pug Puppies Black pug puppies Black pug puppies for sale pug puppies for adoption black pug puppies for sale near me chihuahua pug mix puppies how much is a pug puppy teacup pug puppies baby pug puppies baby pug puppies for sale pictures of pug puppies pug puppies for sale in Ohio pug puppies price pug mix puppies teacup pug puppies for sale best food for pug puppy newborn pug puppies pug puppies craigslist pug puppies for sale craigslist adorable pug puppies how much does a pug puppy cost Pitbull pug mix puppies pug pit mix puppy pug puppies for sale \$200 pug puppies for sale in NJ Pug puppies for sale in Wisconsin pug puppy cost pug puppy food royal canin pug puppy royal canin pug puppy food fawn pug puppy pug puppies for sale florida pug puppies for sale in Indiana pug puppies for sale in KY pug puppies for sale in NC pug dog puppy AKC Registered Pug Puppies For sale cheap pug puppies for sale near me cheap pug puppies for sale in California cheap pug puppies for sale in nj Black Pug Puppies for sale pugs puppies for sale
Perfecthomepugs · 97 weeks and 2 days ago
pugpuppies95 · 59 weeks and 3 days ago
Selamat datang di situs TIMUR188 Bagi kalian yang gemar bermain game online, kalian telah berada di tempat yang tepat. TIMUR188 adalah situs game online yang gacor dan terpercaya. Di sini, kalian dapat menikmati berbagai jenis permainan seru dan mendapatkan pengalaman bermain yang tak terlupakan. Untuk memulai bermain di TIMUR188, kalian hanya perlu mendaftar dan membuat akun secara gratis. Proses pendaftaran sangat mudah dan cepat, sehingga kalian tidak perlu repot-repot menunggu lama untuk bisa bermain. Setelah memiliki akun, kalian bisa melakukan deposit dengan mudah melalui berbagai metode pembayaran yang disediakan. TIMUR188 juga menyediakan layanan customer service yang siap membantu kalian 24 jam non-stop. Jika kalian mengalami kendala atau memiliki pertanyaan seputar situs ini, kalian bisa langsung menghubungi customer service melalui live chat atau kontak yang disediakan. TIMUR188 selalu siap memberikan solusi terbaik untuk kalian. Selain kelancaran akses, keamanan juga menjadi prioritas utama di situs ini. TIMUR188 menggunakan sistem keamanan yang canggih dan terpercaya untuk melindungi data pribadi dan transaksi kalian. Kalian dapat bermain dengan tenang tanpa khawatir data kalian akan disalahgunakan oleh pihak yang tidak bertanggung jawab. Jadi, tunggu apalagi? Bergabunglah sekarang juga di situs TIMUR188 dan nikmati pengalaman bermain game online yang gacor dan terpercaya. Dapatkan keseruan dan keuntungan yang tidak akan kalian temukan di situs lain. Jangan lewatkan kesempatan emas ini! Selamat bermain Salap Jp dari TIMUR188
projack · 33 weeks and 1 day ago
Jangan lewatkan kesempatan emas ini! Selamat bermain Salap Jp dari TIMUR188
projack · 31 weeks and 1 day ago
Selamat datang di situs TIMUR188 Bagi kalian yang gemar bermain game online, kalian telah berada di tempat yang tepat. TIMUR188 adalah situs game online yang gacor dan terpercaya.
projack · 31 weeks ago

### What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

### What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.