Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Dashes vs slashes in a oneliner

by Rex(Wrecks) (Curate)
on Jan 30, 2003 at 18:26 UTC ( [id://231404]=perlquestion: print w/replies, xml ) Need Help??

Rex(Wrecks) has asked for the wisdom of the Perl Monks concerning the following question:

I have been given severall scripts to maintain. They are packaged in tarballs, and then grouped into more tarballs and then grouped into more tarballs, and they use an installer to install them. The problem that I'm running into is that inside each tarball is an installer script written in perl that has "bad" syntax. I know that the scripts have worked before, but they are barfing now. The "bad" syntax is:

system perl -pi -e s-xxx-`uname -n`- htmlfilename

instead of:

system perl -pi -e s/xxx/`uname -n`/ htmlfilename

Now, since fixing this requires me to open all tarballs and hunt things out I was wondering what I need to do to the environment to make this work instead. Like I said, I know I have used the exact same installer scripts before and they worked, but on the next machine they are not.

And before we get into the "It should be fixed right", it is being fixed right, by the people who have checkin rights, and that means I can't get the package for at least a month (don't ask) and I would like this to work now, without having to go through all the tarballs and find every occurance.

Thanks for your help.

"Nothing is sure but death and taxes" I say combine the two and its death to all taxes!

Replies are listed 'Best First'.
•Re: Dashes vs slashes in a oneliner
by merlyn (Sage) on Jan 30, 2003 at 18:42 UTC
    Using my psychic powers, I predict your old box didn't have a dash anywhere within the hostname, but the new one does.

    Do I win the prize?

    The dashes are just delimiters, but you have to be careful as to what uname -n returns.

    -- Randal L. Schwartz, Perl hacker
    Be sure to read my standard disclaimer if this is a reply.

      You have just won a shiney, slightly used, half full, styrofoam coffee cup!!!

      "Nothing is sure but death and taxes" I say combine the two and its death to all taxes!
Re: Dashes vs slashes in a oneliner
by Rex(Wrecks) (Curate) on Jan 30, 2003 at 18:44 UTC
    tye called this one right, the command uname -n returned a value with a - char in it...hence my problem.

    "Nothing is sure but death and taxes" I say combine the two and its death to all taxes!
Re: Dashes vs slashes in a oneliner
by robartes (Priest) on Jan 30, 2003 at 19:00 UTC
    Not going into the fact that there are probably a lot of ways to do this differently (this way, you are launching three processes to do a simple substition in a file), I hazard a guess that `uname -n` is returning a string that contains a dash, whereas it did not before. Unfortunately, if that's the problem, you are pretty much obliged to change the scripts...

    CU
    Robartes-

      Personally, I'd go ahead and make sure every hostname on my network didn't have a '-', then make that a requirement for anyone using my ...

      Ooops. Wrong forum. I thought I was on Evilmonks.

      ------
      We are the carpenters and bricklayers of the Information Age.

      Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

      Heh, not really. Since the machine is mine, I just change the hostname :)

      "Nothing is sure but death and taxes" I say combine the two and its death to all taxes!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://231404]
Approved by Mr. Muskrat
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-04-24 00:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found