Various shells of the system

Source: Internet
Author: User

#!/bin/bash
2 # numbers.sh:digital representation of several different numbers.
3
4 # Tenin-process: Default Condition
5 let "Dec = 32"
6 echo "Decimal number = $dec" # 32
7 #it's nothing special..
8
9
Ten # 8in-process: in' 0 ' (0)start
One-let "oct = 032"
echo "Octal number = $oct" # 26
#The result of an expression isTenthe binary representation of the.
#---------------------------
15
#in-process: in' 0x 'or' 0X 'number starting with
"hex = 0x32"
echo "Hexadecimal number = $hex" # 50
#The result of an expression isTenthe binary representation of the.
20
#Other binary: Base#number
# BASEthe range in2to the -between.
# Numbermust use the value of theBASEa symbol within a range to represent, See the example below for details.
24
25
"Bin = 2#111100111001101"
echo "Binary number = $bin" # 31181
28
"B32 = 32#77"
echo "base-32 number = $b 32" # 231
31
"B64 = 64#@_"
echo "base-64 number = $b 64" # 4031
#This notation works only on restrictedASCIICharacter Range(2-64).
# Tena number+ +a lowercase letter+ +Uppercase characters+ @ + _
36
37
Echo
39
+ Echo $ ((36#ZZ)) $ ((2#10101010)) $ ((16#AF16)) $ ((53#1AA))
41 # 1295 170 44822 3375
42
43
#important points to note:
#---------------
#using a number that goes beyond a given binary.,
#+will cause an error.
48
"BAD_OCT = 081"
# (part of) error message Output:
Wuyi # bad_oct = 081:value too great for base (Error token is "081")
# octal numbers use only digits in the range 0-7.

Various shells of the system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.