<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: script to find .netrc file in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-find-netrc-file/m-p/4507358#M681127</link>
    <description>num=$(find / -name .netrc 2&amp;gt;/dev/null | wc -l)&lt;BR /&gt;&lt;BR /&gt;if [ ${num} -eq 0 ] ; then &lt;BR /&gt;  echo "OK"&lt;BR /&gt;else&lt;BR /&gt;  echo "NOK  ${num}"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;Duncan</description>
    <pubDate>Sun, 04 Oct 2009 10:28:32 GMT</pubDate>
    <dc:creator>Duncan Edmonstone</dc:creator>
    <dc:date>2009-10-04T10:28:32Z</dc:date>
    <item>
      <title>script to find .netrc file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-find-netrc-file/m-p/4507357#M681126</link>
      <description>Hi,&lt;BR /&gt;please provide me with a script to find &lt;BR /&gt;&lt;BR /&gt;.netrc file in a system)&lt;BR /&gt;&lt;BR /&gt;please use the below command in the script&lt;BR /&gt;&lt;BR /&gt;find / -name .netrc&lt;BR /&gt;&lt;BR /&gt;this script is only for checking &lt;BR /&gt;&lt;BR /&gt;the script will give an output as &lt;BR /&gt;&lt;BR /&gt;-if there is no .netrc file present in system it will echo "OK"&lt;BR /&gt;&lt;BR /&gt;-if there is one or more than .netrc file(s) then it will echo "NOK" &amp;amp; the number of files present.&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;chicuks</description>
      <pubDate>Sun, 04 Oct 2009 10:10:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-find-netrc-file/m-p/4507357#M681126</guid>
      <dc:creator>chicuks</dc:creator>
      <dc:date>2009-10-04T10:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: script to find .netrc file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-find-netrc-file/m-p/4507358#M681127</link>
      <description>num=$(find / -name .netrc 2&amp;gt;/dev/null | wc -l)&lt;BR /&gt;&lt;BR /&gt;if [ ${num} -eq 0 ] ; then &lt;BR /&gt;  echo "OK"&lt;BR /&gt;else&lt;BR /&gt;  echo "NOK  ${num}"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;Duncan</description>
      <pubDate>Sun, 04 Oct 2009 10:28:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-find-netrc-file/m-p/4507358#M681127</guid>
      <dc:creator>Duncan Edmonstone</dc:creator>
      <dc:date>2009-10-04T10:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: script to find .netrc file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-find-netrc-file/m-p/4507359#M681128</link>
      <description>If you are going to spend hours searching for .netrc files, you might want to save the result from Duncan's find:&lt;BR /&gt;find / -name .netrc &amp;gt; netrc_files 2&amp;gt; /dev/null&lt;BR /&gt;num=$(wc -l &amp;lt; netrc_files)</description>
      <pubDate>Sun, 04 Oct 2009 10:50:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-find-netrc-file/m-p/4507359#M681128</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-10-04T10:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: script to find .netrc file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-find-netrc-file/m-p/4507360#M681129</link>
      <description>The .netrc files are only bad when they are in home directories. It might be quicker to look only there. You also shortcut the loop as soon as you find the first .netrc by using break.&lt;BR /&gt;&lt;BR /&gt;found_netrc=0&lt;BR /&gt;cat /etc/passwd |cut -d: -f 6 |&lt;BR /&gt;while read homedir&lt;BR /&gt;do&lt;BR /&gt;  if [ -f $homedir/.netrc ]&lt;BR /&gt;  then&lt;BR /&gt;    found_netrc=1&lt;BR /&gt;    break&lt;BR /&gt;  fi&lt;BR /&gt;done&lt;BR /&gt;[ $found_netrc = 0 ] &amp;amp;&amp;amp; echo OK || echo NOK&lt;BR /&gt;</description>
      <pubDate>Sun, 04 Oct 2009 11:16:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-find-netrc-file/m-p/4507360#M681129</guid>
      <dc:creator>TTr</dc:creator>
      <dc:date>2009-10-04T11:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: script to find .netrc file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-find-netrc-file/m-p/4507361#M681130</link>
      <description>.netrc files are meaningless unless they are in a user's $HOME directory. Don't crush your system performance by looking in / -- that is a total waste of time. Assuming that you have a normal system, all user home directories will be in /home so this one liner will show you all the .netrc files to be concerned about:&lt;BR /&gt; &lt;BR /&gt;ll /home/*/.netrc&lt;BR /&gt; &lt;BR /&gt;If nothing shows then there are no .netrc files in $HOME directories. Now I said 'normal' system, so if you have users with non-standard $HOME directories, you'll have to search using the passwd file. This will look in the exact user $HOME directory:&lt;BR /&gt; &lt;BR /&gt;cut -f6 -d: /etc/passwd | while read HOMEDIR&lt;BR /&gt;do&lt;BR /&gt;NETRC=$HOMEDIR/.netrc&lt;BR /&gt;[ -f $NETRC ] &amp;amp;&amp;amp; ll $NETRC || echo "\t$NETRC not present"&lt;BR /&gt;done&lt;BR /&gt; &lt;BR /&gt;If .netrc is found, there will be an ll of the file. Otherwise, there is a message that is indented saying that the file is not present.</description>
      <pubDate>Sun, 04 Oct 2009 21:28:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-find-netrc-file/m-p/4507361#M681130</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2009-10-04T21:28:56Z</dc:date>
    </item>
  </channel>
</rss>

