Recent Changes - Search:

Softwares

.

BashScripting


Adding the directory to the content of the path variable.

                export PATH="$PATH:~/scripts"

Debugging script.

                sh script1.sh

                bash -x script1.sh

The first line of the script determines the shell to start. The first two characters of the first line should be #!, then follows the path to the shell that should interpret the commands that follow. Blank lines are also considered to be lines, so don't start your script with an empty line.

               #!/bin/bash

As noted before, this implies that the Bash executable can be found in /bin debugger for Bash, available at http://bashdb.sourceforge.net

Activating debugging part of the script and then stopping debugging.

   set -x                  # activate debugging from here
   w
   set +x                  # stop debugging from here

Use the command below to identify the process tree with the process id's.

   pstree -p

   usage: pstree [ -a ] [ -c ] [ -h | -H pid ] [ -l ] [ -n ] [ -p ] [ -u ]
              [ -G | -U ] [ pid | user]
       pstree -V

    -a     show command line arguments
    -c     don't compact identical subtrees
    -h     highlight current process and its ancestors
    -H pid highlight process "pid" and its ancestors
    -G     use VT100 line drawing characters
    -l     don't truncate long lines
    -n     sort output by PID
    -p     show PIDs; implies -c
    -u     show uid transitions
    -U     use UTF-8 (Unicode) line drawing characters
    -V     display version information
    pid    start at pid, default 1 (init)
    user   show only trees rooted at processes of that user

Edit - History - Print - Recent Changes - Search
Page last modified on December 13, 2012, at 02:05 AM