Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
01-24-2010, 05:20 AM
|
#1
|
LQ Newbie
Registered: Jan 2010
Posts: 23
Rep:
|
Syntax Error -- related Perl
I have an executable file named macstat, macstat is attached with this message. i have added .txt extension to it as the file without extension was not able to attach.
Whenever i run this file on my linux pc running fedora core 4, i get the following error in terminal:
Code:
[root@ethertester ~]# macstat
Code:
/asic/common/bin/macstat:
line 16: use: command not found
/asic/common/bin/macstat: line 17: use: command not found
/asic/common/bin/macstat: line 19: my: command not found
/asic/common/bin/macstat: line 20: my: command not found
/asic/common/bin/macstat: line 21: my: command not found
/asic/common/bin/macstat: line 23: syntax error near unexpected token `}'
/asic/common/bin/macstat: line 23: `sub usage {die "Usage: macstat save|calc ethx\n";}'
The result of the command:
Code:
[root@ethertester ~]# macstat save eth0
should be:
Code:
macstat version 1.3
I think macstat is a perl file and i don't know anything about perl. A file named perl, csh and tcsh is located in /usr/local/bin.
Please help me out asap.
Thank you in anticipation.
Last edited by rohit0825; 01-24-2010 at 12:31 PM.
|
|
|
01-24-2010, 06:05 AM
|
#2
|
Member
Registered: Feb 2008
Distribution: Slackware
Posts: 595
Rep: 
|
Try:
Code:
$ /usr/local/bin/perl -w /asic/common/bin/macstat
|
|
|
01-24-2010, 06:18 AM
|
#3
|
LQ Newbie
Registered: Jan 2010
Posts: 23
Original Poster
Rep:
|
Quote:
Originally Posted by zordrak
Try:
Code:
$ /usr/local/bin/perl -w /asic/common/bin/macstat
|
Thanks for your reply
i got the following error after i run the above command.
bash: /usr/local/bin/perl : cannot execute binary file
|
|
|
01-24-2010, 06:41 AM
|
#4
|
LQ Newbie
Registered: Jan 2010
Posts: 23
Original Poster
Rep:
|
Please Somebody HELP
|
|
|
01-24-2010, 07:07 AM
|
#5
|
Member
Registered: Jan 2004
Location: Gießen, Germany
Distribution: Xubuntu 12.04, Mythbuntu, Ubuntu Server 12.04
Posts: 174
Rep:
|
The macstat script's shebang line (first line, #!/usr/local....) expects perl to be /usr/local/bin/perl
Find out where your perl binary is:
Probably this will report "/usr/bin/perl"
Change the shebang line in macstat accordingly and try
|
|
|
01-24-2010, 07:27 AM
|
#6
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,520
|
How about editing line 1 in " macstat "
to /usr/bin/perl
.. which is the default location for the binary ' perl '
in Fedora.
Runs OK : perl macstat
.. and replies : Usage: macstat save|calc ethx
.....
Last edited by knudfl; 01-24-2010 at 07:30 AM.
|
|
|
01-24-2010, 07:31 AM
|
#7
|
LQ Newbie
Registered: Jan 2010
Posts: 23
Original Poster
Rep:
|
Quote:
Originally Posted by ricstirato
The macstat script's shebang line (first line, #!/usr/local....) expects perl to be /usr/local/bin/perl
Find out where your perl binary is:
Probably this will report "/usr/bin/perl"
Change the shebang line in macstat accordingly and try
|
Actually i have pasted perl file from another system to /usr/local/bin directory.
and
also return
|
|
|
01-24-2010, 07:46 AM
|
#8
|
LQ Newbie
Registered: Jan 2010
Posts: 23
Original Poster
Rep:
|
Quote:
Originally Posted by knudfl
How about editing line 1 in " macstat "
to /usr/bin/perl
.. which is the default location for the binary ' perl '
in Fedora.
Runs OK : perl macstat
.. and replies : Usage: macstat save|calc ethx
.....
|
Thanks...
I have pasted perl file from another pc to /usr/local/bin folder.
i don't know whether perl already existed in /usr/bin.
please guide.
|
|
|
01-24-2010, 08:58 AM
|
#9
|
LQ Newbie
Registered: Jan 2010
Posts: 1
Rep:
|
Maybe you can replace the first line of macstat with
#!/bin/env perl
Then it will find perl by itself.
By the way, if you just pasted a perl from another PC, it may cause problems, due to the libraries compatible issue.
|
|
|
01-25-2010, 01:50 AM
|
#10
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,520
|
Quote:
I have pasted perl file from another pc to /usr/local/bin folder
|
Asking for trouble ? Better delete it again.
And edit your program to point to /usr/bin/
.. where the default perl executable is located
( in all Linux, Fedora included.)
.....
|
|
|
01-25-2010, 03:49 AM
|
#11
|
Member
Registered: Feb 2008
Distribution: Slackware
Posts: 595
Rep: 
|
Quote:
Originally Posted by rohit0825
Thanks for your reply
i got the following error after i run the above command.
bash: /usr/local/bin/perl : cannot execute binary file
|
Provide output of:
Code:
$ file /usr/local/bin/perl
$ ls -la /usr/local/bin/perl
|
|
|
01-25-2010, 07:27 AM
|
#12
|
LQ Newbie
Registered: Jan 2010
Posts: 23
Original Poster
Rep:
|
Quote:
Originally Posted by knudfl
Asking for trouble ? Better delete it again.
And edit your program to point to /usr/bin/
.. where the default perl executable is located
( in all Linux, Fedora included.)
.....
|
Thanks....
Problem Solved by changing first line of macstat.
/usr/bin/perl is correct.
|
|
|
01-25-2010, 07:40 AM
|
#13
|
LQ Newbie
Registered: Jan 2010
Posts: 23
Original Poster
Rep:
|
Thanks Everybody for your support
Last edited by rohit0825; 01-25-2010 at 08:43 AM.
|
|
|
All times are GMT -5. The time now is 09:27 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|