Tux L i n u x * G u i d e

v o n * I n g o * B l e c h s c h m i d t * ( c ) * 2 0 0 1
Tux
|Home|

|Neue Artikel|

|Index|

|Liste|

|Code-Snippets|

|Links|

|Allgemeines|

|Cool Stuff|
Shell-Skript-Debugging
Son Sep 9 11:51:56 MEST 2001
Shell-Skript Skript Shell Debugging debug

Dieser Artikel hilft, umfangreiche Shell-Skripte zu debuggen.

LinuxGuide Druckbare Version
Man-Page
Sourcecode
Verwandte Artikel:

Variierender Hintergrund
Text2HTML
Webschnapper in Shell-Skript
Webschnapper (2) in Shell-Skript
Countdown in Shell-Skript



      .~.   
      /V\   
     // \\  
    /(   )\ 
     ^`~'^  
     


Hosted at Sorceforge.net
No ePATENTS
Viewable With Any Browser
Burn All GIFs!

Das Skript, Download:
# debug.sh
 
#!/bin/bash
# debug.sh - Simple debug functions for shell scripts
# Copyright (C) Son Sep  9 11:59:18 MEST 2001 by Ingo Blechschmidt
# The script is from http://www.sourceforge.net/users/rstickley/.
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Ingo Blechschmidt
# Arberstraße 5
# 86179 Augsburg
# E-Mail: iblech@web.de, http://www.way.to/uselinux/
# Tel.: +49 / 821 882955
#
# 

function debug {
  echo -ne "\ndeb> "
  read -e mOn
  while [ ! -z "$mOn" ]; do
    eval $mOn
    echo -ne "\ndeb> "
    read -e mOn
  done
}
  
# Usage:
#
# First call '. debug.sh' in your script at the top. This enables the
# debugging. Call at a place you want to debug the function debug. Then a debug
# prompt is displayed. Use a simple <CR> to return.

 
 

Die Benutzung ist einfach:
# beispielskript.sh
 
#!/bin/bash

. debug.sh

[...]
a=b
debug
[...]
 
 

Das Ergebnis könnte dann zum Beispiel so aussehen:
# Beispiel-Ausgabe
 
deb> echo $a
b

deb> <CR>
 
 

Happy Debugging!

Document Informations: Content-Type: text/html; charset=iso-8859-1
Author: Ingo Blechschmidt
Description: LinuxGuide - Dieser Artikel hilft, umfangreiche Shell-Skripte zu debuggen.
Keywords: Shell-Skript, Skript, Shell, Debugging, debug, LinuxGuide
Robots: all
Copyright: Copyright (C) 2002 by Ingo Blechschmidt
Date: 2003-09-09T11:51:56+02:00

Stichwortverzeichnis | Neue Artikel | Übersicht | Codesnippets | Links | Copyright | Cool Stuff | Home | Druckbare Version | Manpage | Sourcecode |
Diesen Artikel kritisieren, kommentieren oder ergänzen
Einen Neuen Artikel schreiben

 
This website is distributed under the GNU Free Documentation License .