Debugging di script bash: Difference between revisions

From RVM Wiki
Jump to navigation Jump to search
No edit summary
 
mNo edit summary
 
Line 1: Line 1:
E' possibile debuggare degli script bash in diversi modi.
E' possibile debuggare degli script bash in diversi modi.
==Controllo sintassi==
bash -n scriptname
*[http://stackoverflow.com/questions/171924/how-do-i-check-syntax-in-bash-without-running-the-script linux - How do I check syntax in bash without running the script? - Stack Overflow]
*[http://serverfault.com/questions/147628/implementing-dry-run-in-bash-scripts Implementing dry-run in bash scripts - Server Fault]


== Debugging da command line ==
== Debugging da command line ==

Latest revision as of 12:27, 29 September 2011

E' possibile debuggare degli script bash in diversi modi.

Controllo sintassi

bash -n scriptname

Debugging da command line

Lanciare lo script come:

bash -x scriptname

Se si vuole anche l'output delle righe sorgente:

bash -x -v scriptname

Debuggare parte dello script

Inserire la parte da debuggare tra le due direttive:


...
set -x
....
set +x
...

Con il debugger

Bash V3 ha anche un debugger chiamato bashdb.

Riferimenti