LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 09-26-2006, 02:13 AM   #1
FogSwimmer
Member
 
Registered: Sep 2003
Distribution: Kubuntu / debian / SuSE
Posts: 73

Rep: Reputation: 15
rename utility - 'strict subs'


Hi all,

I am a new convert to ubuntu after years of SuSE and Fedora. A few things don't show the behaviour I am used to. One of them is the 'rename' utility.

In a directory I have two files, abc.cfg and abc.hdr. I want to rename them to def.cfg and def.hdr using 'rename'. In other distributions I used

$ rename abc def *

and everything was fine. In ubuntu however I get error 255 and the following message:

Bareword "abc" not allowed while "strict subs" in use at (eval 1) line 1.

What does this mean and how do I fix this?

Thanks,
f
 
Old 09-27-2006, 11:15 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Could it be that rename is aliased in Ubuntu?

alias to find out.

On my box rename is an elf 32-bit executable (file `which rename` to find out), the error you show looks like a 'script' error, not an executable binary error.
 
Old 09-28-2006, 03:47 AM   #3
FogSwimmer
Member
 
Registered: Sep 2003
Distribution: Kubuntu / debian / SuSE
Posts: 73

Original Poster
Rep: Reputation: 15
Hi druuna,

thanks for you suggestion, no alias set however. I traced the rename executable and found that it is in fact a perl script called prename. The first line in this script reads

use strict;

I uncommented this line but to no effect. Now I get

Unquoted string "abc" may clash with future reserved word at (eval 1) line 2.
Unquoted string "abc" may clash with future reserved word at (eval 2) line 2.
Unquoted string "abc" may clash with future reserved word at (eval 3) line 2.
Unquoted string "abc" may clash with future reserved word at (eval 4) line 2.
Unquoted string "abc" may clash with future reserved word at (eval 5) line 2.

Any ideas? If not, I may just copy over the rename executable from a different distro.

All best,
fogswimmer
 
Old 09-28-2006, 09:25 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

I don't have prename on my box, only the binary version I mentioned earlier. But if a perl script only works if you don not use 'use strict' (and/or 'use warnings') it cannot be, and probably isn't, a good perl script (my 2c). Both should be used. Always.

Only thing I can come up with: Is the usage the same as the 'real' rename (man prename)?
 
Old 09-29-2006, 01:35 AM   #5
FogSwimmer
Member
 
Registered: Sep 2003
Distribution: Kubuntu / debian / SuSE
Posts: 73

Original Poster
Rep: Reputation: 15
Hi druuna,

Thanks again. Indeed, the usage seems to differ -- I should have thought of that before. prename is expecting a perl expression. While that may be a useful in some situations it isn't for me, because I need my scripts to run on more than one box and distro. So I'll get rid of the ubuntu prename in favour of the real thing.

Do you happen to know what package rename comes with? Is it in coreutils?

Best,
fogswimmer
 
Old 09-29-2006, 01:40 AM   #6
FogSwimmer
Member
 
Registered: Sep 2003
Distribution: Kubuntu / debian / SuSE
Posts: 73

Original Poster
Rep: Reputation: 15
Hi,

I just found this thread:
http://www.linuxquestions.org/questi....php?p=2255346

which has the answer. Sorry for not finding this before asking. Thanks for your time all the more.

fogswimmer
 
  


Reply



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
what is "strict subs " Joe_Zhu Linux - General 4 05-03-2011 04:32 PM
strict usergroup ?? how to ?? help plz Mr.Bingles Linux - Networking 0 06-07-2004 01:03 AM
Am i right, wrong or just to strict in my views? BajaNick General 23 01-15-2004 08:20 PM
Strict DHCP puzz_1 Linux - Networking 8 06-05-2003 12:20 PM
calling subs from within Perl bickford Programming 8 08-13-2000 07:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 03:31 AM.

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
Open Source Consulting | Domain Registration