Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

406
Views
Convertir decimal a hexadecimal en bash script

Quiero convertir un número decimal (número de índice de bucle) en un script bash a hexadecimal para que lo use otro comando. Algo como:

 for ((i=1; i<=100; i++)) do a=convert-to-decimal($i) echo "$a" done

Donde a debe ser hexadecimal con cuatro dígitos e identificador hexadecimal. Por ejemplo, si el valor de i es 100 , el valor de a debería ser 0x0064 . ¿Cómo hacerlo?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Puedes usar printf .

 $ printf "0x%04x" 100 0x0064

En su ejemplo, probablemente usaría a="$(printf '0x%04x' $i)" .

over 4 years ago · Santiago Trujillo Report

0

eso es lo que estas buscando

para i en seq 1 100 ; hacer printf '%x\n' $he terminado

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!