<?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: Modify a script to work on bash shell rather than ksh in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5866197#M638801</link>
    <description>&lt;P&gt;&amp;gt;I am not quite sure how to create a csv on that line,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Add a title line before your for-loop&lt;/P&gt;&lt;P&gt;echo "Date,Directory,File_count"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then in the loop:&lt;/P&gt;&lt;P&gt;echo "$(date +"%Y-%m-%d:%H:%M"),$dir,$(find $dir -type d | wc -l)"&lt;/P&gt;</description>
    <pubDate>Wed, 14 Nov 2012 10:26:58 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2012-11-14T10:26:58Z</dc:date>
    <item>
      <title>Modify a script to work on bash shell rather than ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5865105#M638785</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what needs to be taken into account when writing for bash? I have a small script that does not work on bash, but is does if I type first ksh on comand prompt&lt;/P&gt;&lt;PRE&gt;#!/bin/ksh
for dir in directory1/subdirectory /directory2/subdirectory
/directory3/subdirectory
do
echo "$dir $( du $dir |wc -l)"
done &amp;gt; ./message1
mailx -s "number of files" fretagi@mcel.co.mz &amp;lt; ./message1&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2012 09:20:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5865105#M638785</guid>
      <dc:creator>NDO</dc:creator>
      <dc:date>2012-11-13T09:20:59Z</dc:date>
    </item>
    <item>
      <title>Re: Modify a script to work on bash shell rather than ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5865133#M638786</link>
      <description>&lt;P&gt;Why would you want to port from a real shell to bash?&lt;/P&gt;&lt;P&gt;If this is because of Linux, you are in the wrong board.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What happens if you just use bash on that fragment?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;echo "$dir $(du $dir | wc -l)"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want the number of files in $dir, you shouldn't be using du(1).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2012 10:00:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5865133#M638786</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-11-13T10:00:59Z</dc:date>
    </item>
    <item>
      <title>Re: Modify a script to work on bash shell rather than ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5865143#M638787</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had originaly had:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;a=`/directory/subdirectory/ | wc -l`
echo "/directory/subdirectory :$a"
b=`/another_dir/subdir/ | wc -l`
echo "/another_dir/subdir :$b"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I wanted to&lt;/P&gt;&lt;PRE&gt;while&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;But a friend told me to use&lt;/P&gt;&lt;PRE&gt;du&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;So, can you advise?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2012 10:08:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5865143#M638787</guid>
      <dc:creator>NDO</dc:creator>
      <dc:date>2012-11-13T10:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: Modify a script to work on bash shell rather than ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5865153#M638788</link>
      <description>&lt;P&gt;&amp;gt;I had originally had:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your archaic `` needs a command:&lt;/P&gt;&lt;P&gt;dir=/directory/subdirectory&lt;BR /&gt;echo "$dir: $(ls $dir | wc -l)"&lt;/P&gt;&lt;P&gt;dir=/another_dir/subdir&lt;BR /&gt;echo "$dir: $(ls $dir | wc -l)"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;But a friend told me to use du:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A ls(1) or find would work better.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2012 10:32:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5865153#M638788</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-11-13T10:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: Modify a script to work on bash shell rather than ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5865427#M638789</link>
      <description>&lt;P&gt;First&lt;/P&gt;&lt;P&gt;#!/usr/bin/ksh and not #!/bin/ksh&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;no need for echo "$dir $(....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then&lt;/P&gt;&lt;PRE&gt;#!/usr/bin/ksh
for dir in directory1/subdirectory /directory2/subdirectory
/directory3/subdirectory
do&lt;BR /&gt;   echo "$dir \c" &lt;BR /&gt;   find "$dir"  | wc -l&lt;BR /&gt;done &amp;gt; ./message1
mailx -s "number of files" fretagi@mcel.co.mz &amp;lt; ./message1&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Nov 2012 16:51:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5865427#M638789</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2012-11-13T16:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: Modify a script to work on bash shell rather than ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5865729#M638790</link>
      <description>&lt;P&gt;Perhaps I'm confused.&amp;nbsp; Did you want to port the script to bash or run it under a bash shell?&lt;/P&gt;&lt;P&gt;I found the script works without changes under bash.&amp;nbsp; And the #!&amp;nbsp; line should enable it to work under bash.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It looks like the du - wc pipeline counts directories not files so you could do this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; echo "$dir $(find $dir -type d | wc -l)"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;#!/usr/bin/ksh and not #!/bin/ksh&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the permanent transition links are there, it should work.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2012 23:08:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5865729#M638790</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-11-13T23:08:09Z</dc:date>
    </item>
    <item>
      <title>Re: Modify a script to work on bash shell rather than ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5866003#M638791</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to run under the&amp;nbsp; bash shell, and for some strange reason its printing only single digits, but there 3 digits number there.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2012 07:06:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5866003#M638791</guid>
      <dc:creator>NDO</dc:creator>
      <dc:date>2012-11-14T07:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: Modify a script to work on bash shell rather than ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5866043#M638792</link>
      <description>&lt;P&gt;&amp;gt;it's printing only single digits, but there 3 digits number there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you provide the output of the script?&lt;/P&gt;&lt;P&gt;And what do you want the script to do with each directory?&lt;/P&gt;&lt;P&gt;Count the number of files or only subdirectories?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2012 07:42:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5866043#M638792</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-11-14T07:42:48Z</dc:date>
    </item>
    <item>
      <title>Re: Modify a script to work on bash shell rather than ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5866057#M638793</link>
      <description>The script is to only count the number of files in the subdirectories:&lt;BR /&gt;the output is:&lt;BR /&gt;/nikira/NIKIRAROOT/RangerData/DiamondTemp/Mcel_Ericsson_CDR_Temp 1&lt;BR /&gt;/nikira/NIKIRAROOT/RangerData/DiamondTemp/Mcel_Ericsson_SGSN_Temp 2&lt;BR /&gt;/nikira/NIKIRAROOT/RangerData/DiamondTemp/Mcel_Ericsson_GGSNCDR_Temp 2&lt;BR /&gt;</description>
      <pubDate>Wed, 14 Nov 2012 07:45:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5866057#M638793</guid>
      <dc:creator>NDO</dc:creator>
      <dc:date>2012-11-14T07:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: Modify a script to work on bash shell rather than ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5866063#M638794</link>
      <description>&lt;P&gt;&amp;gt;The script is to only count the number of files in the subdirectories:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And are you using du(1), ls(1) or find?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2012 07:48:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5866063#M638794</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-11-14T07:48:49Z</dc:date>
    </item>
    <item>
      <title>Re: Modify a script to work on bash shell rather than ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5866085#M638795</link>
      <description>du returns: single digit numbers, and find returns: wc -l</description>
      <pubDate>Wed, 14 Nov 2012 08:01:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5866085#M638795</guid>
      <dc:creator>NDO</dc:creator>
      <dc:date>2012-11-14T08:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: Modify a script to work on bash shell rather than ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5866089#M638796</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now its working I have used the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;echo "$dir $(find $dir -type f |wc -l)"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2012 08:04:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5866089#M638796</guid>
      <dc:creator>NDO</dc:creator>
      <dc:date>2012-11-14T08:04:44Z</dc:date>
    </item>
    <item>
      <title>Re: Modify a script to work on bash shell rather than ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5866113#M638797</link>
      <description>&lt;P&gt;&amp;gt;du returns: single digit numbers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I said, du(1) returns a line for every arg and subdirectory.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2012 08:32:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5866113#M638797</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-11-14T08:32:22Z</dc:date>
    </item>
    <item>
      <title>Re: Modify a script to work on bash shell rather than ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5866117#M638798</link>
      <description>&lt;P&gt;its now working fine, I put in the cron to run every hour, but I what I would like now is to insert those figures in some king database or spreadsheet, to make statiscs on hourly and daily basis.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2012 08:47:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5866117#M638798</guid>
      <dc:creator>NDO</dc:creator>
      <dc:date>2012-11-14T08:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: Modify a script to work on bash shell rather than ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5866149#M638799</link>
      <description>&lt;P&gt;&amp;gt;is to insert those figures in some kind database or spreadsheet, to make statistics on hourly and daily basis.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Well, you could create a CSV by inserting a "," between the name and count.&lt;/P&gt;&lt;P&gt;You probably also want to add a simple timestamp as another field:&lt;/P&gt;&lt;P&gt;echo "$(date +"%Y-%m-%d:%H:%M") ..."&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2012 09:07:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5866149#M638799</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-11-14T09:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: Modify a script to work on bash shell rather than ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5866175#M638800</link>
      <description>please I am not quite sure how to create a csv on that line, if I undestood correctly</description>
      <pubDate>Wed, 14 Nov 2012 09:39:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5866175#M638800</guid>
      <dc:creator>NDO</dc:creator>
      <dc:date>2012-11-14T09:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: Modify a script to work on bash shell rather than ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5866197#M638801</link>
      <description>&lt;P&gt;&amp;gt;I am not quite sure how to create a csv on that line,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Add a title line before your for-loop&lt;/P&gt;&lt;P&gt;echo "Date,Directory,File_count"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then in the loop:&lt;/P&gt;&lt;P&gt;echo "$(date +"%Y-%m-%d:%H:%M"),$dir,$(find $dir -type d | wc -l)"&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2012 10:26:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/modify-a-script-to-work-on-bash-shell-rather-than-ksh/m-p/5866197#M638801</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-11-14T10:26:58Z</dc:date>
    </item>
  </channel>
</rss>

