Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Defactor this code

by sfink (Deacon)
on Feb 11, 2007 at 04:57 UTC ( #599427=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download

  1. or download this
    perl -i.old -lne 'if (/^[\s#]*Port/i) { print "Port 1234" unless $done
    +++ } else { print }' sshd_config
  2. or download this
    perl -i.old -lne 'print unless /^[\s#]*Port/i; END{print "Port 1234"}'
    + sshd_config
  3. or download this
    PORT=1234 perl -i.old -lne 'print unless /^[\s#]*Port/i; END { print "
    +Port $ENV{PORT}" }' sshd_config
  4. or download this
    perl -i.old -lne 'BEGIN { $sshport = pop }; print unless /^[\s#]*Port/
    +i; END { print "Port $sshport" }' sshd_config 1234

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2016-07-02 01:42 GMT
Find Nodes?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?

    Results (18 votes). Check out past polls.