?>/script>'; } ?> Debugear scripts de Bash Widgets Magazine

Autor Tema: Debugear scripts de Bash  (Leído 3411 veces)

0 Usuarios y 1 Visitante están viendo este tema.

vk496

  • Visitante
Debugear scripts de Bash
« en: 26-02-2017, 13:16 (Domingo) »
Perdonar la asuencia. Tengo meses un poco liados, y no me da tiempo a echar horas por aquí.

Aún así, esto te puede venir bien @USUARIONUEVO

Dado cualquier script, como puede ser este:

Código: [Seleccionar]
#!/bin/bash

test=2
array=( a b c d)
echo hola
echo $test

if [ $RANDOM -gt 1000 ]; then

        echo wualaaaa

else

        echo :O

fi

pwd


Puedes debugear todas las variables y el proceso de ejecución con el parámetro -x

Citar
$ bash -x ./a
+ test=2
+ array=(a b c d)
+ echo hola
hola
+ echo 2
2
+ '[' 24493 -gt 1000 ']'
+ echo wualaaaa
wualaaaa
+ pwd
/home/vk496/Documentos

Salu2

Desconectado lupox

  • *******
  • Mensajes: 529
  • volver....
Re:
« Respuesta #1 en: 26-02-2017, 22:30 (Domingo) »
set -x
set +x

set -xv

set -e


Sent from my RM-914_eu_spain_360 using Tapatalk

vk496

  • Visitante
Re: Debugear scripts de Bash
« Respuesta #2 en: 26-02-2017, 22:45 (Domingo) »
Esto hubiese venido genial cuando estaba fallando el instalador UEFI a @teik

Salu2