<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Salomon Johns &#187; fetch</title>
	<atom:link href="http://salomonjohns.com/tag/fetch/feed/" rel="self" type="application/rss+xml" />
	<link>http://salomonjohns.com</link>
	<description>Just a personal blog.</description>
	<lastBuildDate>Wed, 25 Apr 2012 07:49:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Experimenting with Perl</title>
		<link>http://salomonjohns.com/2009/09/experimenting-with-perl/</link>
		<comments>http://salomonjohns.com/2009/09/experimenting-with-perl/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 07:52:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[fetch]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://salomonjohns.com/?p=56</guid>
		<description><![CDATA[Well, this is my first actual experiment with Perl. All it does is chmod 750 some fetch utilities. In my next build I want to set it up so that if the file exists, and if it doesnt, it will prompt you that the file is not on the system and it is being skipped. [...]]]></description>
			<content:encoded><![CDATA[<p>Well, this is my first actual experiment with Perl. All it does is chmod 750 some fetch utilities. In my next build I want to set it up so that if the file exists, and if it doesnt, it will prompt you that the file is not on the system and it is being skipped.</p>

<div class="wp_syntax"><div class="code"><pre class="language" style="font-family:monospace;">#!/usr/bin/perl
# Revision 1 - 09-03-09
# Initial Build
# Chmod 750 of rcp, wget, lynx, links, elinks, scp, nc, ftp, telnet, curl
&nbsp;
print (&quot;Permissions?\n&quot;);
system ('chmod 750 -v /usr/bin/rcp');
system ('chmod 750 -v /usr/bin/wget');
system ('chmod 750 -v /usr/bin/lynx');
system ('chmod 750 -v /usr/bin/links');
system ('chmod 750 -v /usr/bin/elinks');
system ('chmod 750 -v /usr/bin/scp');
system ('chmod 750 -v /usr/bin/nc');
system ('chmod 750 -v /usr/bin/ftp');
system ('chmod 750 -v /usr/bin/telnet');</pre></div></div>

<p>Lets see how this turns out over the next few days.</p>
<p>Update before I go to bed:</p>

<div class="wp_syntax"><div class="code"><pre class="language" style="font-family:monospace;">#!/usr/bin/perl
# Revision 1 - 09-03-09 0055
# Initial Build
# Chmod 750 of rcp, wget, lynx, links, elinks, scp, nc, ftp, ssh, telnet, curl
#
# Revision 2 - 09-03-09 0113
# If else statements are in place, they can handle if the file does or does not exist
&nbsp;
print (&quot;Permissions lol...\n&quot;);
$filename = '/usr/bin/wget';
if (-e $filename) {
print &quot;Found $filename\n&quot;;
system (&quot;chmod 750 -v '/usr/bin/wget'&quot;);
}
else
{ print &quot;File $filename, not found\n&quot;;
}
$filename = '/usr/bin/curl';
if (-e $filename) {
print &quot;Found $filename\n&quot;;
system (&quot;chmod 750 -v '/usr/bin/curl'&quot;);
}
else
{ print &quot;File $filename, not found\n&quot;;
}
$filename = '/usr/bin/rcp';
if (-e $filename) {
print &quot;Founds $filename\n&quot;;
system ('chmod 750 -v /usr/bin/rcp');
}
else
{ print &quot;File $filename, not found\n&quot;;
}
$filename = '/usr/bin/lynx';
if (-e $filename) {
print &quot;Found $filename\n&quot;;
system ('chmod 750 -v /usr/bin/lynx');
}
else
{ print &quot;File $filename, not found\n&quot;;
}
$filename = '/usr/bin/elinks';
if (-e $filename) {
print &quot;Found $filename\n&quot;;
system ('chmod 750 -v /usr/bin/elinks');
}
else
{ print &quot;File $filename, not found\n&quot;;
}
$filename = '/usr/bin/scp';
if (-e $filename) {
print &quot;Found $filename\n&quot;;
system ('chmod 750 -v /usr/bin/scp');
}
else
{ print &quot;File $filename, not found\n&quot;;
}
$filename = '/usr/bin/nc';
if (-e $filename) {
print &quot;Found $filename\n&quot;;
system ('chmod 750 -v /usr/bin/nc');
}
else
{ print &quot;File $filename, not found\n&quot;;
}
$filename = '/usr/bin/ftp';
if (-e $filename) {
print &quot;Found $filename\n&quot;;
system ('chmod 750 -v /usr/bin/ftp');
}
else
{ print &quot;File $filename, not found\n&quot;;
}
$filename = '/usr/bin/telnet';
if (-e $filename) {
print &quot;Found $filename\n&quot;;
system ('chmod 750 -v /usr/bin/telnet');
}
else
{ print &quot;File $filename, not found\n&quot;;</pre></div></div>

<p>}<br />
print &#8220;Permissions set to 750 across the board.\n&#8221;</p>
<p>And now the last revision of the night, colors.</p>

<div class="wp_syntax"><div class="code"><pre class="language" style="font-family:monospace;">#!/usr/bin/perl
# Revision 1 - 09-03-09 0055
# Initial Build
# Chmod 750 of rcp, wget, lynx, links, elinks, scp, nc, ftp, ssh, telnet, curl
#
# Revision 2 - 09-03-09 0113
# If else statements are in place, they can handle if the file does or does not exist
#
# Revision 3 - 09-03-09 0124
# Colors?
&nbsp;
use Term::ANSIColor qw(:constants);
$Term::ANSIColor::AUTORESET = 1; #reset colors after each line, otherwise everything will be green and red
&nbsp;
print (&quot;Permissions lol...\n&quot;);
$filename = '/usr/bin/wget';
if (-e $filename) {
print GREEN &quot;Found $filename\n&quot;;
system (&quot;chmod 750 -v '/usr/bin/wget'&quot;);
}
else
{
print RED &quot;File $filename, not found\n&quot;;
}
$filename = '/usr/bin/curl';
if (-e $filename) {
print GREEN &quot;Found $filename\n&quot;;
system (&quot;chmod 750 -v '/usr/bin/curl'&quot;);
}
else
{ print RED &quot;File $filename, not found\n&quot;;
}
$filename = '/usr/bin/rcp';
if (-e $filename) {
print GREEN &quot;Found $filename\n&quot;;
system ('chmod 750 -v /usr/bin/rcp');
}
else
{ print RED &quot;File $filename, not found\n&quot;;
}
$filename = '/usr/bin/lynx';
if (-e $filename) {
print GREEN &quot;Found $filename\n&quot;;
system ('chmod 750 -v /usr/bin/lynx');
}
else
{
print RED &quot;File $filename, not found\n&quot;;
}
$filename = '/usr/bin/elinks';
if (-e $filename) {
print GREEN &quot;Found $filename\n&quot;;
system ('chmod 750 -v /usr/bin/elinks');
}
else
{ print RED &quot;File $filename, not found\n&quot;;
}
$filename = '/usr/bin/scp';
if (-e $filename) {
print GREEN &quot;Found $filename\n&quot;;
system ('chmod 750 -v /usr/bin/scp');
}
else
{ print RED &quot;File $filename, not found\n&quot;;
}
$filename = '/usr/bin/nc';
if (-e $filename) {
print GREEN &quot;Found $filename\n&quot;;
system ('chmod 750 -v /usr/bin/nc');
}
else
{ print RED &quot;File $filename, not found\n&quot;;
}
$filename = '/usr/bin/ftp';
if (-e $filename) {
print GREEN &quot;Found $filename\n&quot;;
system ('chmod 750 -v /usr/bin/ftp');
}
else
{ print RED &quot;File $filename, not found\n&quot;;
}
$filename = '/usr/bin/telnet';
if (-e $filename) {
print GREEN &quot;Found $filename\n&quot;;
system ('chmod 750 -v /usr/bin/telnet');
}
else
{ print RED &quot;File $filename, not found\n&quot;;
}
print &quot;Permissions set to 750 across the board.\n&quot;</pre></div></div>

<p>Additional reading:<br />
<a href="http://perl.about.com/od/programmingperl/qt/perlexists.htm">http://perl.about.com/od/programmingperl/qt/perlexists.htm</a><br />
<a href="http://perl.active-venture.com/lib/Term/ANSIColor.html">http://perl.active-venture.com/lib/Term/ANSIColor.html</a><br />
<a href="http://www.linuxforums.org/forum/linux-programming-scripting/116383-how-can-i-use-wget-perl.html">http://www.linuxforums.org/forum/linux-programming-scripting/116383-how-can-i-use-wget-perl.html</a></p>
<!-- PHP 5.x -->]]></content:encoded>
			<wfw:commentRss>http://salomonjohns.com/2009/09/experimenting-with-perl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

