<?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 Shell script debugging in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-debugging/m-p/3526395#M220698</link>
    <description>How can I debug a shell script that I have written?</description>
    <pubDate>Sun, 17 Apr 2005 07:38:47 GMT</pubDate>
    <dc:creator>Paul Remeika</dc:creator>
    <dc:date>2005-04-17T07:38:47Z</dc:date>
    <item>
      <title>Shell script debugging</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-debugging/m-p/3526395#M220698</link>
      <description>How can I debug a shell script that I have written?</description>
      <pubDate>Sun, 17 Apr 2005 07:38:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-debugging/m-p/3526395#M220698</guid>
      <dc:creator>Paul Remeika</dc:creator>
      <dc:date>2005-04-17T07:38:47Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script debugging</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-debugging/m-p/3526396#M220699</link>
      <description>You can execute it with:&lt;BR /&gt;sh -x my_script.sh&lt;BR /&gt;&lt;BR /&gt;or change the first line of the script, from:&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;to&lt;BR /&gt;#!/bin/sh -x&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If you use sh/bash ofcourse.</description>
      <pubDate>Sun, 17 Apr 2005 07:54:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-debugging/m-p/3526396#M220699</guid>
      <dc:creator>Alex Lavrov.</dc:creator>
      <dc:date>2005-04-17T07:54:36Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script debugging</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-debugging/m-p/3526397#M220700</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;You can run it  either as&lt;BR /&gt;sh -x script&lt;BR /&gt;or &lt;BR /&gt;insert set -x into the script on the place, which you want to debug&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;HTH</description>
      <pubDate>Sun, 17 Apr 2005 07:55:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-debugging/m-p/3526397#M220700</guid>
      <dc:creator>Victor Fridyev</dc:creator>
      <dc:date>2005-04-17T07:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script debugging</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-debugging/m-p/3526398#M220701</link>
      <description>A couple of notes about set -x:&lt;BR /&gt; &lt;BR /&gt;It will show each step of your script that was executed (with a + in front of each command) but not exactly line by line. A line that has several commands piped into each other will show each command separately. The if or test statements will be shown but the lines that were not executed won't be shown.&lt;BR /&gt; &lt;BR /&gt;To help with the above scenario, use -x and -v. The -v option shows each line (including comments). Note that because the shell is interpreting the script, the original statements and the trace lines may not always be interleaved together. But it does help see where the script is located during the test run.&lt;BR /&gt; &lt;BR /&gt;Another feature of set -x is that the output goes to stderr. Normally, stdout and stderr go to the screen together, but suppose you want to step through the script one page at a time:&lt;BR /&gt; &lt;BR /&gt;sh -vx myscript | more&lt;BR /&gt; &lt;BR /&gt;What you'll see is all the lines for listing and debugging  (immediately) and any of the stdout from the script will go to: | more. To put the two together so that the more command controls all output:&lt;BR /&gt; &lt;BR /&gt;sh -x -v myscript 2&amp;gt;&amp;amp;1 | more&lt;BR /&gt; &lt;BR /&gt;The 2&amp;gt; refers to redirecting stderr and the &amp;amp;1 refers to file descriptor 1 which is stdout. 2&amp;gt;&amp;amp;1 effectively ties both types of output together, so now the more command sees both streams of text.</description>
      <pubDate>Sun, 17 Apr 2005 19:32:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-debugging/m-p/3526398#M220701</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2005-04-17T19:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script debugging</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-debugging/m-p/3526399#M220702</link>
      <description>You can also use set -x and set +x to debug shell script.&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;#debug&lt;BR /&gt;hostname&lt;BR /&gt;# debug starts&lt;BR /&gt;set -x&lt;BR /&gt;ls&lt;BR /&gt;echo bye&lt;BR /&gt;set +x&lt;BR /&gt;echo over&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;HTH.</description>
      <pubDate>Mon, 18 Apr 2005 01:10:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-debugging/m-p/3526399#M220702</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-04-18T01:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script debugging</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-debugging/m-p/3526400#M220703</link>
      <description># ksh -x script.ksh&lt;BR /&gt;or&lt;BR /&gt;# sh -x script.sh&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;- f. halili</description>
      <pubDate>Mon, 18 Apr 2005 07:47:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-debugging/m-p/3526400#M220703</guid>
      <dc:creator>f. halili</dc:creator>
      <dc:date>2005-04-18T07:47:53Z</dc:date>
    </item>
  </channel>
</rss>

