http://qs321.pair.com?node_id=584753


in reply to quick way to add a line to a file, if it's not already present (automating tweaking of /etc/ld.so.conf for installing Image::Magick)

one liner, as requested (:
(it should add one line to the file in case it's not already there and that's all, right?!)
perl -pi -e '$line = 1 if /pattern/; print "the line\n" if !$line&&eof' /etc/ld.so.conf

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*women.pm
  • Comment on Re: quick way to add a line to a file, if it's not already present (automating tweaking of /etc/ld.so.conf for installing Image::Magick)
  • Download Code