Debugging di script bash
Jump to navigation
Jump to search
E' possibile debuggare degli script bash in diversi modi.
Controllo sintassi
bash -n scriptname
- linux - How do I check syntax in bash without running the script? - Stack Overflow
- Implementing dry-run in bash scripts - Server Fault
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.