If you do $((08+1)) or $((09+1)) in terminal, linux shows an error.
However, you can use 07,06,05,04,03,02,01,00, and Linux treat them as 7,6,5,4,3,2,1,0.
Can someone tell me how to make 08 and 09 work in this way?
6 4344
If you do $((08+1)) or $((09+1)) in terminal, linux shows an error.
However, you can use 07,06,05,04,03,02,01,00, and Linux treat them as 7,6,5,4,3,2,1,0.
Can someone tell me how to make 08 and 09 work in this way?
That's easy!
Prefacing a number with a 0 when it isn't the only digit before a decimal (.) will cause most programming languages to treat is as Octal (base 8). The highest numeric digit in octal is 7, thus 8 and 9 will not show up.
If you don't believe me, try 077 and see what you get.
can someone tell me how to make 08 and 09 work as 8, 9?
can someone tell me how to make 08 and 09 work as 8, 9?
As far as I know, this cannot be done in the way you've posed the question. This is similar to asking for 0x11 be represented as 11 (which is certainly not the case).
if you need them to be viewed as 08 and 09 you can do your calculations with the decimal equivalents 0 - 9 and use printf to display them with the leading 0 (zero)
This behavior seems to vary depending on the shell: -
~> echo $SHELL
-
/usr/local/bin/bash
-
~> echo $((09+7))
-
-bash: 09: value too great for base (error token is "09")
-
~> ksh
-
$ echo $((09+7))
-
16
-
$
-
There's also the typeset built-in which can be used for formatting: -
$
-
$ typeset -Z2 num1=9
-
$ typeset -Z3 num2
-
$ num2=8
-
$ echo $num1
-
09
-
$ echo $num2
-
008
-
$ echo $((num1 * num2))
-
72
-
$
-
This worked for me in the bash shell. If I tried to default the dirNUM to 3 digits first then I would error out with the 08 errors. -
dirNUM=1
-
until [[ $dirNUM == 367 ]]
-
do
-
# Change directory number to 3 digits
-
if [[ ! -d ${root_dir}/$(printf "%.3d" $dirNUM) ]]
-
then
-
mkdir ${root_dir}/$(printf "%.3d" $dirNUM)
-
fi
-
((dirNUM+=1))
-
done
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Ryan Park |
last post by:
Hi,
//SITUATION
I got a panel control that hold a certain position on a form.
Every controls or UIs are on this panel.
At certain situation, I called dispose() method of this panel control...
|
by: baustin75 |
last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie
only when debugging in php designer 2005
--------------------------------------------------------------------------------
...
|
by: ~~~ .NET Ed ~~~ |
last post by:
Hi,
I have a standalone XML file (with the appropriate xml document header)
that works fine when I load it using XmlDocument. I can have child elements
like this without problems:
...
|
by: Alfetta159 |
last post by:
I've been setting up a schema with the XML Designer in VS .NET 2003.
The designer lets me set up a lot of things including a complex type that
contains an unnamed complex type called modified.
...
|
by: Jean-David Beyer |
last post by:
I have some programs running on Red Hat Linux 7.3 working with IBM DB2
V6.1 (with all the FixPacks) on my old machine.
I have just installed IBM DB2 V8.1 on this (new) machine running Red Hat...
|
by: Jean-Marc Blaise |
last post by:
Dear all,
I would like to signal an inconvenience with the db2imigr, if root's
environment points to a DB2 instance (Aix).
We did a /usr/opt/db2_08_01/db2ckmig .... worked ok saying db(s) can...
|
by: eelis.net |
last post by:
Hi
I tried to convert the following C# code to vb.net.
code in C#
________________________________________________________________
using System;
using System.Reflection;
using...
|
by: mudge |
last post by:
Hi,
I'm getting some very strange problems with some C# code. We're running
an ASP.NET application on a local server in a DMZ. If I access it using
the internal address, the application works...
|
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= |
last post by:
Hello, mister
I have an application web asp.net 2.0 + vs 2005 and VS 2005 Web Application
Project.
Its appears this error in execution:
"Cannot Create/Shadow Copy '<projectname>' when that...
|
by: SCPOS |
last post by:
Cannot delete X: It is being used by another person or program. Close any programs that might be using the file and try again.
Of course I have tried closing any programs I know of that may be...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| | |