Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: One liner: remove ssh keys with quotemeta

by afoken (Canon)
on Nov 29, 2019 at 12:35 UTC ( #11109431=note: print w/replies, xml ) Need Help??


in reply to Re: One liner: remove ssh keys with quotemeta
in thread One liner: remove ssh keys with quotemeta

exec { "/bin/sed -i -e '\\%${line}%d' '${file}'" : ... }

That would still suffer from the same problem as perl - the default shell. See Re^2: One liner: remove ssh keys with quotemeta.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^3: One liner: remove ssh keys with quotemeta
by jcb (Priest) on Nov 29, 2019 at 17:25 UTC

    While you are correct that the default shell can be a strange critter, the questioner's existing code assumes Bourne-like shell quoting rules, so I offered an example that follows suit.

    A better answer would probably be to write the update routines entirely in Ruby instead of calling out to other programs, but this is PerlMonks, not RubyMonks. :-)

      A better answer would probably be to write the update routines entirely in Ruby instead of calling out to other programs

      You are right. A simple read-modify-write shouldn't be that hard in Ruby, making it atomar atomic by writing to a new file followed by a rename shouldn't be hard, either.

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11109431]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2020-05-26 18:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (150 votes). Check out past polls.

    Notices?