Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Question Command to "profile" a script? (i.e. execute it line by line with "hit space" breaks)


    Hi all,

    i am looking for a command/software that will "profile" a script file, i.e. execute it line by line, stopping for "Press any key to continue" type of message that awaits user input.

    I need this, because i have a large script that basically builds a custom GNU/Linux distribution, but i want to see the results of each step before hitting Space for instance to move on. And no, i would not want to log to a file instead, because if something goes wrong in the middle of my big script, and it simply continue, i will not know what went wrong until after the completion of the script when i look at the log file.

    Thanks in advance.

  2. #2
    Linux Engineer aliov's Avatar
    Join Date
    Dec 2006
    Location
    Geneva,Beirut
    Posts
    1,078
    Probably there is many ways to do this but what i use the following .

    echo -n "Press Enter to continue"
    read


    Hope this Help.
    Regards.
    Linux is not only an operating system, it's a philosophy.
    Archost.

  3. #3

    Exclamation

    Quote Originally Posted by aliov View Post
    Probably there is many ways to do this but what i use the following .

    echo -n "Press Enter to continue"
    read


    Hope this Help.
    Regards.
    This implies i put the echo line mentioned after each part i want paused, right?

    The script has to go without such lines, if possible. What you suggest is hardwire the pausing logic inside the script file.

    perhaps some sort of piping could do?

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Engineer drl's Avatar
    Join Date
    Apr 2006
    Location
    Saint Paul, MN, USA / CentOS, Debian, Slackware, {Free, Open, Net}BSD, Solaris
    Posts
    1,472
    -->
    Hi.

    I consider a profiler to be different from a debugger.

    The book below includes a chapter on a script debugger written as a shell script. It allows breakpoints, single stepping, etc.

    Often O'Reilly has the code on-line for downloading ... cheers, drl

    Title: Learning the bash Shell
    Author: Cameron Newham
    Edition: Third
    Date: 2005
    Publisher: O'Reilly
    ISBN: 0596009658
    Pages: 376
    Categories: bash, scripting, unix, linux, shell, programming
    Comments: 4 stars, 27 reviews (Amazon 2007.08 )
    Comments: ( I have 2nd edition, 1998 )
    Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
    90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
    We look forward to helping you with the challenge of the other 10%.
    ( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •