LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 12-20-2010, 07:40 PM   #1
kaoticsnow
Member
 
Registered: Apr 2010
Posts: 35

Rep: Reputation: 0
Post Perl help


I'm having a bit of trouble with a perl script, I'm getting command not found errors when trying to define variables:

Code:
#!/usr/bin/perl
# Set behaviour
$workingdir="/home/cisco/bkup"; 
$snmprw="RW_STRING"; 
$ipaddress="172.16.1.5";
$days="30";


$rtrlist="$workingdir/RTR_LIST";
$storage="$workingdir/storage";
$latest="$storage/LATEST";
$prev="$storage/PREV";
I get the following errors when exicuting:

Code:
./backup.pl: line 9: =/home/cisco/bkup: No such file or directory
./backup.pl: line 10: =RW_STRING: command not found
./backup.pl: line 11: =172.16.1.5: command not found
./backup.pl: line 12: =30: command not found
./backup.pl: line 15: =/RTR_LIST: No such file or directory
./backup.pl: line 16: =/storage: No such file or directory
./backup.pl: line 17: =/LATEST: No such file or directory
./backup.pl: line 18: =/PREV: No such file or directory
I'm also getting errors about the working directory not existing, but it does:

Code:
[mon01 bkup]# pwd
/home/cisco/bkup
Ideas?
 
Old 12-20-2010, 08:23 PM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,652

Rep: Reputation: 536Reputation: 536Reputation: 536Reputation: 536Reputation: 536Reputation: 536
How are you executing it? Does it behave different with "perl filename.pl" ?
 
Old 12-20-2010, 08:53 PM   #3
kaoticsnow
Member
 
Registered: Apr 2010
Posts: 35

Original Poster
Rep: Reputation: 0
That was one problem, Thanks! now I just need to figure out why its not able to connect to the device and pull the backups. but thats another issue I believe.
 
Old 12-20-2010, 09:42 PM   #4
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,652

Rep: Reputation: 536Reputation: 536Reputation: 536Reputation: 536Reputation: 536Reputation: 536
Ok, so it sounds to me like you were trying to execute this perl script as a shell file. According to the shell, $workingdir would be empty, so the first non-comment line would be "=/home/cisco/bkup" which of course is not a valid commmand.

Assuming /usr/bin/perl exists, chmod'ing the file +x and running ./filename.pl should work. And so will "perl filename.pl" without having to set it executable.
 
Old 12-20-2010, 09:45 PM   #5
kaoticsnow
Member
 
Registered: Apr 2010
Posts: 35

Original Poster
Rep: Reputation: 0
I already chmod'ed the file +x but it made no difference, theres no problem simply executing it with the Perl command but I'm probably going to ditch the script anyway, as I can not get it to actually pull down the configs from my cisco devices.
 
  


Reply

Tags
perl, script, snmp


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to find libmail-mbox-messageparser-perl and libmailtools-perl for Fedora 11 almac58 Linux - Software 4 11-18-2009 04:17 AM
LXer: Installing Eclipse, the Epic Perl plugin and my first Perl GUI program LXer Syndicated Linux News 0 05-08-2009 07:41 PM
RHEL4u2 perl localtime() call issues (perl & glibc) Brad.Scalio@noaa.gov Linux - Enterprise 3 01-23-2007 10:27 PM
perl(Cwd) perl(File::Basename) perl(File::Copy) perl(strict)....What are those? Baldorg Linux - Software 1 11-09-2003 09:09 PM
chrooting apache v2 (php, ssl, perl support) ; perl configuration markus1982 Linux - Security 3 01-26-2003 07:15 PM


All times are GMT -5. The time now is 06:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration