<?xml version="1.0" encoding="utf-8"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>DaniWeb IT Discussion Community - Shell Scripting</title>
		<link>http://www.daniweb.com/forums</link>
		<description><![CDATA[Our Shell Scripting forum is the place for Q&A-style discussions related to *nix shell scripting languages such as bash. Note that we also have a separate Perl forum within the Software Development category.]]></description>
		<language>en-US</language>
		<lastBuildDate>Wed, 08 Oct 2008 02:42:48 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.daniweb.com/forums/myimages/misc/rss.jpg</url>
			<title>DaniWeb IT Discussion Community - Shell Scripting</title>
			<link>http://www.daniweb.com/forums</link>
		</image>
		<item>
			<title>newline characters disappearing</title>
			<link>http://www.daniweb.com/forums/thread149647.html</link>
			<pubDate>Tue, 07 Oct 2008 04:53:18 GMT</pubDate>
			<description><![CDATA[Running ubuntu 8.04

I built this off of the tripwire daily cron script. I'm trying to check the number of violations.

There's a problem when $tripResult is instantiated with the tripwire report- it doesn't have any newline characters.

This causes grep to not get the line with the number of...]]></description>
			<content:encoded><![CDATA[<div>Running ubuntu 8.04<br />
<br />
I built this off of the tripwire daily cron script. I'm trying to check the number of violations.<br />
<br />
There's a problem when $tripResult is instantiated with the tripwire report- it doesn't have any newline characters.<br />
<br />
This causes grep to not get the line with the number of violations, it just gets the entire report.<br />
<br />
#!/bin/sh -e<br />
<br />
tripwire=/usr/sbin/tripwire<br />
<br />
[ -x $tripwire ] || exit 0<br />
<br />
umask 027<br />
<br />
tripResult=$($tripwire --check --quiet)<br />
<br />
tripViolations=$(echo $tripResult | grep &quot;Total violations found&quot; | awk '{print $4}')<br />
<br />
exit 0</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>shwick</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread149647.html</guid>
		</item>
		<item>
			<title>finding files for specified date</title>
			<link>http://www.daniweb.com/forums/thread149246.html</link>
			<pubDate>Sun, 05 Oct 2008 07:32:55 GMT</pubDate>
			<description><![CDATA[Hi,

I want to find out files which were created,modified, accessed  on specified date say "1 Oct 2008" and after that  on file system level.

can u please suggest me how to find that ?]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I want to find out files which were created,modified, accessed  on specified date say &quot;1 Oct 2008&quot; and after that  on file system level.<br />
<br />
can u please suggest me how to find that ?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>born4unix</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread149246.html</guid>
		</item>
		<item>
			<title>Bash script</title>
			<link>http://www.daniweb.com/forums/thread148850.html</link>
			<pubDate>Fri, 03 Oct 2008 06:52:28 GMT</pubDate>
			<description><![CDATA[Hi to all the experts here, I am a true newbie on bash script and I have a couple of questions need to seek help:

1. What does "safe" delete command script means? I am confused with this statement:
Write a "safe" delete command script. Filenames passed as command-line arguments to this script are...]]></description>
			<content:encoded><![CDATA[<div>Hi to all the experts here, I am a true newbie on bash script and I have a couple of questions need to seek help:<br />
<br />
1. What does &quot;safe&quot; delete command script means? I am confused with this statement:<br />
Write a &quot;safe&quot; delete command script. Filenames passed as command-line arguments to this script are not deleted, but instead gzipped if not already compressed, then moved to a /home/username/trash directory.<br />
<br />
Basically it is an assignment, does it means those file names typed in command line will not be deleted and compress it to tarz if it is not?  How to implement it using file command? Thanks in advance.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>evios</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread148850.html</guid>
		</item>
		<item>
			<title>How can i set column width in unix?</title>
			<link>http://www.daniweb.com/forums/thread148509.html</link>
			<pubDate>Wed, 01 Oct 2008 12:42:37 GMT</pubDate>
			<description>mY QUERY IS RELATED TO..

How can i set coloumn width in unix...

Like for ex. i am having a file, whose content is like 

------------------------------
aba bba  baba 
abba         baba         baaa
    addd    ffff     fffff</description>
			<content:encoded><![CDATA[<div>mY QUERY IS RELATED TO..<br />
<br />
How can i set coloumn width in unix...<br />
<br />
Like for ex. i am having a file, whose content is like <br />
<br />
------------------------------<br />
aba bba  baba <br />
abba         baba         baaa<br />
    addd    ffff     fffff<br />
-----------------------------------<br />
i want it to be like <br />
-----------------------------------<br />
aba     bba     baba <br />
abba   baba    baaa<br />
addd   ffff       fffff<br />
------------------------------------<br />
How can i set the coloumn width in unix... Please reply asap.<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>RohitSahni</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread148509.html</guid>
		</item>
		<item>
			<title>Maintain the log</title>
			<link>http://www.daniweb.com/forums/thread148347.html</link>
			<pubDate>Tue, 30 Sep 2008 13:05:56 GMT</pubDate>
			<description><![CDATA[Hi all,

I am new to shell script.
I'm currently running a java application using shell script.
When i'm running the java applicaton i need to print all the System.out.println()  statements in a file.
I don't know how to implement it..
Can any one help me on this.
Thanks in advance 
:)]]></description>
			<content:encoded><![CDATA[<div>Hi all,<br />
<br />
I am new to shell script.<br />
I'm currently running a java application using shell script.<br />
When i'm running the java applicaton i need to print all the System.out.println()  statements in a file.<br />
I don't know how to implement it..<br />
Can any one help me on this.<br />
Thanks in advance <br />
:) <br />
<br />
Regards,<br />
Ajay</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>ajay23</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread148347.html</guid>
		</item>
		<item>
			<title>Dynamically-created shell commands</title>
			<link>http://www.daniweb.com/forums/thread148173.html</link>
			<pubDate>Mon, 29 Sep 2008 13:47:03 GMT</pubDate>
			<description><![CDATA[I am trying to dynamically create some shell script and run it (but don't know how!).

I want to read in a string from a file (e.g. 'echo $myvar') then run that string (and, yes, myvar IS an existing variable).

Can it be done? I have thought about writing it off to a .sh file and executing the...]]></description>
			<content:encoded><![CDATA[<div>I am trying to dynamically create some shell script and run it (but don't know how!).<br />
<br />
I want to read in a string from a file (e.g. '<pre style="margin:20px; line-height:13px">echo $myvar</pre>') then run that string (and, yes, myvar IS an existing variable).<br />
<br />
Can it be done? I have thought about writing it off to a .sh file and executing the file, but I can't get that to work either.<br />
<br />
To put the problem into context, I want to read in a bunch of commands from a file and run them, and they may contain names of existing variables.<br />
<br />
Incidentally, I'm using bash, but a general solution will be fine.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>Jaoqua</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread148173.html</guid>
		</item>
		<item>
			<title>How to display java logged messages using Shell scripts</title>
			<link>http://www.daniweb.com/forums/thread147611.html</link>
			<pubDate>Thu, 25 Sep 2008 09:11:12 GMT</pubDate>
			<description>Hi All,

  I have some log messages and sysout statments in my java code.
I am executing my code through a shell script.
I could able to see all my sysout statments since I have redirected stdout message to a file.
Now I need to see the log messages to the same output file.
Please if somebody could...</description>
			<content:encoded><![CDATA[<div>Hi All,<br />
<br />
  I have some log messages and sysout statments in my java code.<br />
I am executing my code through a shell script.<br />
I could able to see all my sysout statments since I have redirected stdout message to a file.<br />
Now I need to see the log messages to the same output file.<br />
Please if somebody could help me to solve the above problem.<br />
<br />
Thanks,<br />
  Karthiga</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>KarthigaB</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread147611.html</guid>
		</item>
		<item>
			<title>hi, shell /awk for getting echo the linenumber from log file</title>
			<link>http://www.daniweb.com/forums/thread147593.html</link>
			<pubDate>Thu, 25 Sep 2008 06:54:25 GMT</pubDate>
			<description>Something off the box: I got a log file of the pattern say like this :

                 19876   Exception happened at heylog.php.
                 19878   Argument missing

               I need a shell script / awk which should get the file, read the line and should get me the line number...</description>
			<content:encoded><![CDATA[<div>Something off the box: I got a log file of the pattern say like this :<br />
<br />
                 19876   Exception happened at heylog.php.<br />
                 19878   Argument missing<br />
<br />
               I need a shell script / awk which should get the file, read the line and should get me the line number displayed with that message in the line and then should replace it with a Fixed Markup text, like say it becomes like this once the print to screen is done:<br />
               <br />
                19876  Exception happened at heylog.php<br />
                19878  Static Fixed known error<br />
<br />
             This line code does not print the line that i got from the above lines in the script. i took this from a googled example<br />
      file = //some file manipulation<br />
      line = // get the line number          <br />
      # awk 'NR==$line{print;exit}' web.log.1<br />
      //Above code awk ... does not get the $line while prints. how to get this $line. this is where i am stuck.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>hbmarar</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread147593.html</guid>
		</item>
		<item>
			<title>monitor and suspend</title>
			<link>http://www.daniweb.com/forums/thread147580.html</link>
			<pubDate>Thu, 25 Sep 2008 03:37:26 GMT</pubDate>
			<description>Hi there,
sry all for my bad english
i have this script but need to modify something if anyone can do it for me ,
this script need to start it in my linux box in process to monitor and when user deplete CPU or MySQL or something in (10%) need to suspend that user for 15MIN.. for example in manual...</description>
			<content:encoded><![CDATA[<div>Hi there,<br />
sry all for my bad english<br />
i have this script but need to modify something if anyone can do it for me ,<br />
this script need to start it in my linux box in process to monitor and when user deplete CPU or MySQL or something in (10%) need to suspend that user for 15MIN.. for example in manual command<br />
<pre style="margin:20px; line-height:13px"> /scripts/suspendacct user<br />
/scripts/unsuspendacct user</pre>
<br />
<br />
<pre style="margin:20px; line-height:13px">#!/bin/bash<br />
usageHelp=&quot;Usage: ${0##*/}&quot;<br />
uidHelp=&quot;-u starting uid, must be an integer greater than or equal to 0 (only used with \&quot;-w users\&quot;)&quot;<br />
maxCpuHelp=&quot;-m max cpu, must be an integer greater than or equal to 0 and less than 100&quot;<br />
watchHelp=&quot;-w what to watch, must be \&quot;users\&quot; or \&quot;procs\&quot;&quot;<br />
emailHelp=&quot;-e must contain an email address&quot;<br />
debugHelp=&quot;-d specifies debug mode in which -e, -m, and -u do not need to be specified.&quot;<br />
badOptionHelp=&quot;Option not recognised&quot;<br />
printHelpAndExit()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;$usageHelp&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;$uidHelp&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;$maxCpuHelp&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;$watchHelp&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;$emailHelp&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;$debugHelp&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; exit $1<br />
}<br />
printErrorHelpAndExit()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;$@&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo<br />
&nbsp; &nbsp; &nbsp; &nbsp; printHelpAndExit 1<br />
}<br />
whatTowatch=&quot;&quot;<br />
email=&quot;&quot;<br />
startAtUid=&quot;-1&quot;<br />
maxCpuUsage=&quot;-1&quot;<br />
debug=&quot;&quot;<br />
while getopts &quot;hw:e:u:m:d&quot; optionName; do<br />
&nbsp; &nbsp; &nbsp; &nbsp; case &quot;$optionName&quot; in<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; h)&nbsp; &nbsp; &nbsp; &nbsp; printHelpAndExit 0;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; d)&nbsp; &nbsp; &nbsp; &nbsp; debug=&quot;0&quot;;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; w)&nbsp; &nbsp; &nbsp; &nbsp; whatTowatch=&quot;$OPTARG&quot;;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e)&nbsp; &nbsp; &nbsp; &nbsp; email=&quot;$OPTARG&quot;;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; u)&nbsp; &nbsp; &nbsp; &nbsp; startAtUid=&quot;$OPTARG&quot;;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m)&nbsp; &nbsp; &nbsp; &nbsp; maxCpuUsage=&quot;$OPTARG&quot;;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [?])&nbsp; &nbsp; &nbsp; &nbsp; printErrorHelpAndExit &quot;$badOptionHelp&quot;;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; esac<br />
done<br />
outputCmd=&quot;mail -s 'CPU Abusers on ${HOSTNAME}' $email&quot;<br />
[[ &quot;$whatTowatch&quot; != &quot;users&quot; ]] &amp;&amp; [[ &quot;$whatTowatch&quot; != &quot;procs&quot; ]] &amp;&amp; printErrorHelpAndExit &quot;$watchHelp&quot;<br />
if [[ -z &quot;$debug&quot; ]]<br />
then<br />
&nbsp; &nbsp; &nbsp; &nbsp; ( [[ &quot;$maxCpuUsage&quot; -ge 0 ]] &amp;&amp; [[ &quot;$maxCpuUsage&quot; -le 100 ]] ) || printErrorHelpAndExit &quot;$maxCpuHelp&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; [[ &quot;$startAtUid&quot; -eq -1 ]] &amp;&amp; [[ &quot;$whatTowatch&quot; == &quot;users&quot; ]] &amp;&amp; printErrorHelpAndExit &quot;$uidHelp&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; [[ -z &quot;$email&quot; ]] &amp;&amp; printErrorHelpAndExit &quot;$emailHelp&quot;<br />
else<br />
&nbsp; &nbsp; &nbsp; &nbsp; outputCmd=cat<br />
fi<br />
tmpOutputFile=$( mktemp -q -t tmp.cpu.XXXXXXXXXXXX 2&gt;/dev/null )<br />
if [[ -z &quot;$tmpOutputFile&quot; ]] || [[ ! -f &quot;$tmpOutputFile&quot; ]]<br />
then<br />
&nbsp; &nbsp; &nbsp; &nbsp; tmpOutputFile=&quot;/tmp/tmp.cpu.$(date +%S).$$&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; I=0<br />
&nbsp; &nbsp; &nbsp; &nbsp; while [[ -f &quot;$tmpOutputFile&quot; ]]<br />
&nbsp; &nbsp; &nbsp; &nbsp; do<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tmpOutputFile=&quot;$tmpOutputFile.$I&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ((I++))<br />
&nbsp; &nbsp; &nbsp; &nbsp; done<br />
fi<br />
trap &quot;rm -f $tmpOutputFile; exit&quot; SIGINT SIGTERM<br />
usersToWatch()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; awk -F: '{print $1 , $3}' /etc/passwd | \<br />
&nbsp; &nbsp; &nbsp; &nbsp; while read user id<br />
&nbsp; &nbsp; &nbsp; &nbsp; do<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if [ $id -ge $startAtUid ]<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo $user<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fi<br />
&nbsp; &nbsp; &nbsp; &nbsp; done<br />
}<br />
sum()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; local cum=0<br />
&nbsp; &nbsp; &nbsp; &nbsp; for i in $@<br />
&nbsp; &nbsp; &nbsp; &nbsp; do<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (( cum = cum + ${i%.*} ))<br />
&nbsp; &nbsp; &nbsp; &nbsp; done<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo $cum<br />
}<br />
abusersExist()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; if [[ &quot;$whatTowatch&quot; == &quot;users&quot; ]]<br />
&nbsp; &nbsp; &nbsp; &nbsp; then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for user in $( usersToWatch )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; do<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cpu=$( ps -o pcpu -u $user | grep -v CPU )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; local cumUsage=$( sum $cpu )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if [[ $cumUsage -ge $maxCpuUsage ]]<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;User $user is using $cumUsage% cpu.&quot; &gt;&gt; $tmpOutputFile<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fi<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; done<br />
&nbsp; &nbsp; &nbsp; &nbsp; elif [[ &quot;$whatTowatch&quot; == &quot;procs&quot; ]]<br />
&nbsp; &nbsp; &nbsp; &nbsp; then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; local last=&quot;&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; local cumUsage=0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ps -o comm,pcpu -e | grep -v CPU | sort | \<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while read comm cpu<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; do<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if [[ &quot;$comm&quot; != &quot;$last&quot; ]] &amp;&amp; [[ ! -z &quot;$last&quot; ]]<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if [[ $cumUsage -ge $maxCpuUsage ]]<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;Process $last is using $cumUsage% cpu.&quot; &gt;&gt; $tmpOutputFile<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fi<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cumUsage=0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fi<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cumUsage=$( sum $cumUsage $cpu )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last=&quot;$comm&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; done<br />
&nbsp; &nbsp; &nbsp; &nbsp; fi<br />
}<br />
abusersExist<br />
if [ -s $tmpOutputFile ]<br />
then<br />
&nbsp; &nbsp; &nbsp; &nbsp; ( date; cat $tmpOutputFile ) | eval &quot;$outputCmd&quot;<br />
fi<br />
rm -f $tmpOutputFile</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>camila22</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread147580.html</guid>
		</item>
		<item>
			<title>Help with for loop syntax</title>
			<link>http://www.daniweb.com/forums/thread147126.html</link>
			<pubDate>Mon, 22 Sep 2008 15:06:26 GMT</pubDate>
			<description><![CDATA[Howdy, I'm a total newbie to scripting and I can't figure out the proper syntax to shell script a for loop for the following scenario: I have a directory of symbolic links to backup log files. I want to loop through the dir to cat the last 21 lines of each file and put all the output to another...]]></description>
			<content:encoded><![CDATA[<div>Howdy, I'm a total newbie to scripting and I can't figure out the proper syntax to shell script a for loop for the following scenario: I have a directory of symbolic links to backup log files. I want to loop through the dir to cat the last 21 lines of each file and put all the output to another file. I can't seem to get the loop to do what I want no matter how many different iterations of cat list | tail -21 etc. I try. I've looked through all my available books and on the web but so far no luck in finding just the right combo. Many thanks in advance for any help.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>bmead</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread147126.html</guid>
		</item>
		<item>
			<title>Shell scripting</title>
			<link>http://www.daniweb.com/forums/thread147092.html</link>
			<pubDate>Mon, 22 Sep 2008 11:48:09 GMT</pubDate>
			<description><![CDATA[Does anyone know if it's possible to create a shellscript that knows when it's fopen()ed? So when any process fopens() it, it can take an action? 

Thanks in advance,]]></description>
			<content:encoded><![CDATA[<div>Does anyone know if it's possible to create a shellscript that knows when it's fopen()ed? So when any process fopens() it, it can take an action? <br />
<br />
Thanks in advance,</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>Clockowl</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread147092.html</guid>
		</item>
		<item>
			<title>bash expect issues</title>
			<link>http://www.daniweb.com/forums/thread146899.html</link>
			<pubDate>Sat, 20 Sep 2008 21:29:30 GMT</pubDate>
			<description><![CDATA[hello, I wrote an expect script to automate ssh commands, and it was working, but for some reason it's not anymore.  Just to make sure I didn't do any weird changes that I didn't notice, I tried several of the dozens of such scripts that are online, and for some reason, none of them work.  Here's...]]></description>
			<content:encoded><![CDATA[<div>hello, I wrote an expect script to automate ssh commands, and it was working, but for some reason it's not anymore.  Just to make sure I didn't do any weird changes that I didn't notice, I tried several of the dozens of such scripts that are online, and for some reason, none of them work.  Here's the script I wrote, that did work at one time, but maybe there are some suggestions, I'm not the best at shell scripting.<br />
<br />
I wrote this to work with ssh as well as rsync, so $1 is the command you want it to run, with $2 being the password, example of calling this would be: &quot;./shell-script 'user@server.com ls' 'password'&quot;<br />
<br />
I am using ubuntu linux.<br />
<br />
<pre style="margin:20px; line-height:13px">#!/bin/bash<br />
#!/usr/bin/expect<br />
<br />
expect -c &quot;<br />
spawn $1<br />
expect {<br />
password: { send $2; exp_continue }<br />
}<br />
exit<br />
&quot;<br />
<br />
exit 0</pre>
<br />
I should add, that this script will call the command ($1), but it will hang when it comes to entering the password.  I've tried several different strings for it to expect, none of them work.  The format ssh outputs for asking the password is 'user@server.com's password:' so I've tried 'password:', 'word:' and ':'<br />
<br />
thanks<br />
~J</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>jesseb07</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread146899.html</guid>
		</item>
		<item>
			<title>Find las modifyed files</title>
			<link>http://www.daniweb.com/forums/thread146750.html</link>
			<pubDate>Fri, 19 Sep 2008 22:13:15 GMT</pubDate>
			<description>Hello 

I am trying to use the find command to search for the last files modifyed under certain directory

Example: #find /tmp -mtime -1 

find all the files modifyed from 1 hour ago

The question is: Somebody knows hou can I do the same but using minutes or seconds instead of hours. 
I am new to...</description>
			<content:encoded><![CDATA[<div>Hello <br />
<br />
I am trying to use the find command to search for the last files modifyed under certain directory<br />
<br />
Example: #find /tmp -mtime -1 <br />
<br />
find all the files modifyed from 1 hour ago<br />
<br />
The question is: Somebody knows hou can I do the same but using minutes or seconds instead of hours. <br />
I am new to scripting so I would apreciate any help</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>rast1979</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread146750.html</guid>
		</item>
		<item>
			<title>batch file to delete files based on the criteria</title>
			<link>http://www.daniweb.com/forums/thread146106.html</link>
			<pubDate>Tue, 16 Sep 2008 15:09:50 GMT</pubDate>
			<description>Hi can anyone helpme out in writing a batch file to delete archived log files.
The batch file should delete the files in those folders that meet the criteria(files older than 3 months)and if all the files in the folder are deleted then the folder itself should be deleted.</description>
			<content:encoded><![CDATA[<div>Hi can anyone helpme out in writing a batch file to delete archived log files.<br />
The batch file should delete the files in those folders that meet the criteria(files older than 3 months)and if all the files in the folder are deleted then the folder itself should be deleted.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>Duvva</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread146106.html</guid>
		</item>
		<item>
			<title>Shell Script Newbie Needs Some Help</title>
			<link>http://www.daniweb.com/forums/thread145942.html</link>
			<pubDate>Mon, 15 Sep 2008 19:18:20 GMT</pubDate>
			<description>Hi,

As the title suggests, I am completely clueless when it comes to shell scripts.  However, I am in a position where I need to write one so I thought would ask for some help.  What I need to do is dump every database in my instance of mysql into a directory (/home/foo/bar for example).  This is...</description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
As the title suggests, I am completely clueless when it comes to shell scripts.  However, I am in a position where I need to write one so I thought would ask for some help.  What I need to do is dump every database in my instance of mysql into a directory (/home/foo/bar for example).  This is on an offsite location and I am doing this so that I can make the task of backing up website data a much simpler process.  Also, I know that I can call mysqldump for each database that I have, but I am representing an institution with many databases and new projects are always starting so I need a more elegant and maintainable solution.<br />
<br />
Thank you,<br />
Nick</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>neclark2</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread145942.html</guid>
		</item>
	</channel>
</rss>
