<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Debugging scripts KSH in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/debugging-scripts-ksh/m-p/2974194#M928034</link>
    <description>Hi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;See set options in manpage and put&lt;BR /&gt;&lt;BR /&gt;At the start of the script&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;                     -p   Disables processing of the $HOME/.profile file and&lt;BR /&gt;                          uses the file /etc/suid_profile instead of the ENV&lt;BR /&gt;                          file.  This mode is on whenever the effective uid&lt;BR /&gt;                          (gid) is not equal to the real uid (gid).  Turning&lt;BR /&gt;                          this off causes the effective uid and gid to be&lt;BR /&gt;                          set to the real uid and gid.&lt;BR /&gt;                     -s   Sort the positional parameters.&lt;BR /&gt;                     -t   Exit after reading and executing one command.&lt;BR /&gt;                     -u   Treat unset parameters as an error when&lt;BR /&gt;                          substituting.&lt;BR /&gt;                     -v   Print shell input lines as they are read.&lt;BR /&gt;                     -x   Print commands and their arguments as they are&lt;BR /&gt;                          executed.&lt;BR /&gt;                     -    Turns off -x and -v options and stops examining&lt;BR /&gt;                          arguments for options.&lt;BR /&gt;                     --   Do not change any of the options; useful in&lt;BR /&gt;                          setting $1 to a value beginning with -.  If no&lt;BR /&gt;                          arguments follow this option, the positional&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;                              Steve Steel</description>
    <pubDate>Thu, 15 May 2003 12:20:26 GMT</pubDate>
    <dc:creator>Steve Steel</dc:creator>
    <dc:date>2003-05-15T12:20:26Z</dc:date>
    <item>
      <title>Debugging scripts KSH</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/debugging-scripts-ksh/m-p/2974193#M928033</link>
      <description>Hello colleagues,&lt;BR /&gt;are there any tools to execute step by step a KSH script?&lt;BR /&gt;sorry for the stupid question :-)&lt;BR /&gt;&lt;BR /&gt;Enrico</description>
      <pubDate>Thu, 15 May 2003 12:15:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/debugging-scripts-ksh/m-p/2974193#M928033</guid>
      <dc:creator>Enrico Venturi</dc:creator>
      <dc:date>2003-05-15T12:15:49Z</dc:date>
    </item>
    <item>
      <title>Re: Debugging scripts KSH</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/debugging-scripts-ksh/m-p/2974194#M928034</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;See set options in manpage and put&lt;BR /&gt;&lt;BR /&gt;At the start of the script&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;                     -p   Disables processing of the $HOME/.profile file and&lt;BR /&gt;                          uses the file /etc/suid_profile instead of the ENV&lt;BR /&gt;                          file.  This mode is on whenever the effective uid&lt;BR /&gt;                          (gid) is not equal to the real uid (gid).  Turning&lt;BR /&gt;                          this off causes the effective uid and gid to be&lt;BR /&gt;                          set to the real uid and gid.&lt;BR /&gt;                     -s   Sort the positional parameters.&lt;BR /&gt;                     -t   Exit after reading and executing one command.&lt;BR /&gt;                     -u   Treat unset parameters as an error when&lt;BR /&gt;                          substituting.&lt;BR /&gt;                     -v   Print shell input lines as they are read.&lt;BR /&gt;                     -x   Print commands and their arguments as they are&lt;BR /&gt;                          executed.&lt;BR /&gt;                     -    Turns off -x and -v options and stops examining&lt;BR /&gt;                          arguments for options.&lt;BR /&gt;                     --   Do not change any of the options; useful in&lt;BR /&gt;                          setting $1 to a value beginning with -.  If no&lt;BR /&gt;                          arguments follow this option, the positional&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;                              Steve Steel</description>
      <pubDate>Thu, 15 May 2003 12:20:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/debugging-scripts-ksh/m-p/2974194#M928034</guid>
      <dc:creator>Steve Steel</dc:creator>
      <dc:date>2003-05-15T12:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: Debugging scripts KSH</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/debugging-scripts-ksh/m-p/2974195#M928035</link>
      <description>add the line &lt;BR /&gt;&lt;BR /&gt;set -x &lt;BR /&gt;&lt;BR /&gt;in the second line of your script.&lt;BR /&gt;&lt;BR /&gt;Robert-Jan.</description>
      <pubDate>Thu, 15 May 2003 12:25:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/debugging-scripts-ksh/m-p/2974195#M928035</guid>
      <dc:creator>Robert-Jan Goossens</dc:creator>
      <dc:date>2003-05-15T12:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: Debugging scripts KSH</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/debugging-scripts-ksh/m-p/2974196#M928036</link>
      <description>Hi Enrico:&lt;BR /&gt;&lt;BR /&gt;Steve has listed some of the more useful options.&lt;BR /&gt;&lt;BR /&gt;You can leverage these without modifing your script by simply doing, for example:&lt;BR /&gt;&lt;BR /&gt;# ksh -x yourscript&lt;BR /&gt;&lt;BR /&gt;Another useful technique is to have 'trap' statements in your script for DEBUG and ERR.  For example:&lt;BR /&gt;&lt;BR /&gt;# trap 'echo Debug handler entered' DEBUG&lt;BR /&gt;# trap 'echo Error handler entered' ERR&lt;BR /&gt;&lt;BR /&gt;See the 'sh-posix' or 'ksh' man pages for more information.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 15 May 2003 12:36:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/debugging-scripts-ksh/m-p/2974196#M928036</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2003-05-15T12:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: Debugging scripts KSH</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/debugging-scripts-ksh/m-p/2974197#M928037</link>
      <description>Hi,&lt;BR /&gt;another little trick.&lt;BR /&gt;&lt;BR /&gt;If after setting the debug mode (i call it so) you want to log everything, you can use the "script filename" command.&lt;BR /&gt;&lt;BR /&gt;this utility let you dump all video output (std out and std err) and your input to the file mentioned, very usefull for debugging purpose.&lt;BR /&gt;&lt;BR /&gt;  Massimo</description>
      <pubDate>Thu, 15 May 2003 12:46:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/debugging-scripts-ksh/m-p/2974197#M928037</guid>
      <dc:creator>Massimo Bianchi</dc:creator>
      <dc:date>2003-05-15T12:46:51Z</dc:date>
    </item>
    <item>
      <title>Re: Debugging scripts KSH</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/debugging-scripts-ksh/m-p/2974198#M928038</link>
      <description>Hi (again) Enrico:&lt;BR /&gt;&lt;BR /&gt;Here's another example of how you might leverage the DEBUG signal to monitor your script.  Remember that the trap could be set and reset around regions of your code.  Hence, consider this example  &lt;BR /&gt;&lt;BR /&gt;#/usr/bin/ksh&lt;BR /&gt;echo "hello world!"&lt;BR /&gt;[ X"$1" = X-d ] &amp;amp;&amp;amp; trap 'echo "@line-${LINENO}' DEBUG&lt;BR /&gt;echo "where am I?"&lt;BR /&gt;date&lt;BR /&gt;[ X"$1" = X-d ] &amp;amp;&amp;amp; trap '' DEBUG&lt;BR /&gt;echo "debug mode off"&lt;BR /&gt;date&lt;BR /&gt;echo "where am I?"&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;Run the script this way:&lt;BR /&gt;&lt;BR /&gt;# ./my.sh&lt;BR /&gt;&lt;BR /&gt;...then, with debug mode on:&lt;BR /&gt;&lt;BR /&gt;# ./my.sh -d&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Thu, 15 May 2003 13:16:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/debugging-scripts-ksh/m-p/2974198#M928038</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2003-05-15T13:16:33Z</dc:date>
    </item>
  </channel>
</rss>

