Answer by eordano for Hexadecimal To Decimal in Shell Script
I have this handy script on my $PATH to filter 0x1337-like; 1337; or "0x1337" lines of input into decimal strings (expanded for clarity):#!/usr/bin/env bashwhile read data; do withoutQuotes=`echo...
View ArticleAnswer by Kostas for Hexadecimal To Decimal in Shell Script
Shortest way yet:$ echo $[0x3F]63
View ArticleAnswer by novice for Hexadecimal To Decimal in Shell Script
In dash and other shells, you can useprintf "%d\n" (your hexadecimal number)to convert a hexadecimal number to decimal.This is not specific to bash or ksh.
View ArticleAnswer by user2350426 for Hexadecimal To Decimal in Shell Script
The error as reported appears when the variables are null (or empty):$ unset var3 var4; var5=$(($var4-$var3))bash: -: syntax error: operand expected (error token is "-")That could happen because the...
View ArticleAnswer by hinekyle for Hexadecimal To Decimal in Shell Script
Dealing with a very lightweight embedded version of busybox on Linux means many of the traditional commands are not available (bc, printf, dc, perl, python)echo $((0x2f))47hexNum=2fecho...
View ArticleAnswer by Tomás Fox for Hexadecimal To Decimal in Shell Script
One more way to do it using the shell (bash or ksh, doesn't work with dash):echo $((16#FF))255
View ArticleAnswer by ghoti for Hexadecimal To Decimal in Shell Script
Various tools are available to you from within a shell. Sputnick has given you an excellent overview of your options, based on your initial question. He definitely deserves votes for the time he spent...
View ArticleAnswer by Gilles Quénot for Hexadecimal To Decimal in Shell Script
To convert from hex to decimal, there are many ways to do it in the shell or with an external program:With bash:$ echo $((16#FF))255with bc:$ echo "ibase=16; FF" | bc255with perl:$ perl -le 'print...
View ArticleHexadecimal To Decimal in Shell Script
Can someone help me to convert a hexadecimal number to decimal number in a shell script?E.g., I want to convert the hexadecimal number bfca3000 to decimal using a shell script. I basically want the...
View Article
More Pages to Explore .....