<?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: Shell programing in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970095#M417705</link>
    <description>I've created two files&lt;BR /&gt;&lt;BR /&gt;root@lev /Ignite_Bckp&amp;gt;more test.sh &lt;BR /&gt;while read host;&lt;BR /&gt;do&lt;BR /&gt;ssh ${host}&lt;BR /&gt;done &amp;lt; hosts_test.txt&lt;BR /&gt;&lt;BR /&gt;and file containing hosts (in the same dir)&lt;BR /&gt;&lt;BR /&gt;root@lev /Ignite_Bckp&amp;gt;more hosts_test.txt &lt;BR /&gt;adam&lt;BR /&gt;kate&lt;BR /&gt;&lt;BR /&gt;when executing script test.sh I get error:&lt;BR /&gt;&lt;BR /&gt;root@lev /Ignite_Bckp&amp;gt;chmod +x hosts_test.txt &lt;BR /&gt;root@lev /Ignite_Bckp&amp;gt;./hosts_test.txt &lt;BR /&gt;./hosts_test.txt: adam:  not found.&lt;BR /&gt;./hosts_test.txt[2]: kate:  not found.&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 28 Mar 2006 09:52:18 GMT</pubDate>
    <dc:creator>Igor Sovin</dc:creator>
    <dc:date>2006-03-28T09:52:18Z</dc:date>
    <item>
      <title>Shell programing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970084#M417694</link>
      <description>I have text file with several strings in it.&lt;BR /&gt;for example &lt;BR /&gt;more 123.txt&lt;BR /&gt;aa&lt;BR /&gt;bb&lt;BR /&gt;cc&lt;BR /&gt;dd&lt;BR /&gt;&lt;BR /&gt;I need to make script that could read these strings from 123.txt and write them in another txt file.&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Mar 2006 05:39:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970084#M417694</guid>
      <dc:creator>Igor Sovin</dc:creator>
      <dc:date>2006-03-28T05:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: Shell programing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970085#M417695</link>
      <description>cp 123.txt what_ever.txt&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Mar 2006 05:40:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970085#M417695</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2006-03-28T05:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: Shell programing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970086#M417696</link>
      <description>while read line; do&lt;BR /&gt;&lt;BR /&gt; echo ${line}&lt;BR /&gt;&lt;BR /&gt;done &amp;lt; inputfile &amp;gt; &lt;OUTPUTFILE&gt;&lt;BR /&gt;&lt;BR /&gt;You can copy all the contents if you are not going to any changes as,&lt;BR /&gt;&lt;BR /&gt;cp &lt;FILE&gt; &lt;NEWFILE&gt;&lt;BR /&gt;&lt;BR /&gt;--&lt;BR /&gt;Muthu&lt;/NEWFILE&gt;&lt;/FILE&gt;&lt;/OUTPUTFILE&gt;</description>
      <pubDate>Tue, 28 Mar 2006 05:48:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970086#M417696</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2006-03-28T05:48:16Z</dc:date>
    </item>
    <item>
      <title>Re: Shell programing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970087#M417697</link>
      <description>Igor,&lt;BR /&gt;if you insists on a script:&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;while read record&lt;BR /&gt;do&lt;BR /&gt;echo $record &amp;gt;&amp;gt; output.txt&lt;BR /&gt;done &amp;lt; 123.txt&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Mar 2006 05:49:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970087#M417697</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2006-03-28T05:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: Shell programing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970088#M417698</link>
      <description>Are you going to do any shell program or changes in content? or simply that contents itself?!&lt;BR /&gt;&lt;BR /&gt;More ways to simply copy the file contents to new.&lt;BR /&gt;&lt;BR /&gt;cat file &amp;gt; newfile&lt;BR /&gt;&lt;BR /&gt;--&lt;BR /&gt;Muthu</description>
      <pubDate>Tue, 28 Mar 2006 05:53:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970088#M417698</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2006-03-28T05:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Shell programing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970089#M417699</link>
      <description>I have the following script:&lt;BR /&gt;&lt;BR /&gt;for i in 1 2 3&lt;BR /&gt;do&lt;BR /&gt;command ${variable} &lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;I need to get aa then bb and cc from 123.txt and put it into my script instead of variable.&lt;BR /&gt;How to do that?</description>
      <pubDate>Tue, 28 Mar 2006 05:53:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970089#M417699</guid>
      <dc:creator>Igor Sovin</dc:creator>
      <dc:date>2006-03-28T05:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: Shell programing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970090#M417700</link>
      <description>Use like:&lt;BR /&gt;&lt;BR /&gt;for i in 1 2 3&lt;BR /&gt;do &lt;BR /&gt;  while read variable;&lt;BR /&gt;  do&lt;BR /&gt;     command ${variable}&lt;BR /&gt;  done &amp;lt; 123.txt&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;That is it.&lt;BR /&gt;&lt;BR /&gt;--&lt;BR /&gt;Muthu</description>
      <pubDate>Tue, 28 Mar 2006 06:00:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970090#M417700</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2006-03-28T06:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: Shell programing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970091#M417701</link>
      <description>Can you just ellaborate your requirement to give effect script solution!? In the for loop you are not using i variable anywhere. &lt;BR /&gt;&lt;BR /&gt;Post requirement as:&lt;BR /&gt;&lt;BR /&gt;1) input&lt;BR /&gt;2) expected output from input&lt;BR /&gt;&lt;BR /&gt;--&lt;BR /&gt;Muthu</description>
      <pubDate>Tue, 28 Mar 2006 06:03:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970091#M417701</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2006-03-28T06:03:19Z</dc:date>
    </item>
    <item>
      <title>Re: Shell programing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970092#M417702</link>
      <description>the problem is :&lt;BR /&gt;&lt;BR /&gt;1. I have txt file containing list of remote hosts.&lt;BR /&gt;host1&lt;BR /&gt;host2&lt;BR /&gt;host3 etc&lt;BR /&gt;2. I need to do script that reads host1 from txt file and ssh to host1 do the command then exit from host1, and this action must be done for all hosts ( host2, host3.. etc).&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Mar 2006 06:20:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970092#M417702</guid>
      <dc:creator>Igor Sovin</dc:creator>
      <dc:date>2006-03-28T06:20:40Z</dc:date>
    </item>
    <item>
      <title>Re: Shell programing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970093#M417703</link>
      <description>1. I have txt file containing list of remote hosts.&lt;BR /&gt;host1&lt;BR /&gt;host2&lt;BR /&gt;host3 etc&lt;BR /&gt;2. I need to do script that reads host1 from txt file and ssh to host1 do the command then exit from host1, and this action must be done for all hosts ( host2, host3.. etc).&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;BR /&gt;&lt;BR /&gt;Simply as,&lt;BR /&gt;&lt;BR /&gt;put all hosts in &amp;gt; hosts file. So host1,host2 and etc are in hosts file.&lt;BR /&gt;&lt;BR /&gt;while read host;&lt;BR /&gt;do&lt;BR /&gt;  ssh &lt;USERNAME&gt;@${host} 'command'&lt;BR /&gt;done &amp;lt; hosts&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If you don't want to specify the hostname then,&lt;BR /&gt;&lt;BR /&gt;while read host;&lt;BR /&gt;do&lt;BR /&gt;  ssh ${host} 'command'&lt;BR /&gt;done &amp;lt; hosts&lt;BR /&gt;&lt;BR /&gt;will do that.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;PS: Hope you have set key transaction between hosts for not asking password. Else it will ask password.&lt;BR /&gt;&lt;BR /&gt;--&lt;BR /&gt;Muthu&lt;BR /&gt;&lt;/USERNAME&gt;</description>
      <pubDate>Tue, 28 Mar 2006 06:25:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970093#M417703</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2006-03-28T06:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: Shell programing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970094#M417704</link>
      <description>let me try..</description>
      <pubDate>Tue, 28 Mar 2006 06:30:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970094#M417704</guid>
      <dc:creator>Igor Sovin</dc:creator>
      <dc:date>2006-03-28T06:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: Shell programing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970095#M417705</link>
      <description>I've created two files&lt;BR /&gt;&lt;BR /&gt;root@lev /Ignite_Bckp&amp;gt;more test.sh &lt;BR /&gt;while read host;&lt;BR /&gt;do&lt;BR /&gt;ssh ${host}&lt;BR /&gt;done &amp;lt; hosts_test.txt&lt;BR /&gt;&lt;BR /&gt;and file containing hosts (in the same dir)&lt;BR /&gt;&lt;BR /&gt;root@lev /Ignite_Bckp&amp;gt;more hosts_test.txt &lt;BR /&gt;adam&lt;BR /&gt;kate&lt;BR /&gt;&lt;BR /&gt;when executing script test.sh I get error:&lt;BR /&gt;&lt;BR /&gt;root@lev /Ignite_Bckp&amp;gt;chmod +x hosts_test.txt &lt;BR /&gt;root@lev /Ignite_Bckp&amp;gt;./hosts_test.txt &lt;BR /&gt;./hosts_test.txt: adam:  not found.&lt;BR /&gt;./hosts_test.txt[2]: kate:  not found.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Mar 2006 09:52:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970095#M417705</guid>
      <dc:creator>Igor Sovin</dc:creator>
      <dc:date>2006-03-28T09:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: Shell programing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970096#M417706</link>
      <description>&lt;BR /&gt;You reversed the files and are trying to exectue the data (.txt) file.&lt;BR /&gt;&lt;BR /&gt;Try:&lt;BR /&gt;&lt;BR /&gt;chmod +x test.sh&lt;BR /&gt;./test.sh&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Also... I generally preferr to keep the parameter out of the script file. You your case that means removing the "&amp;lt; node_test.txt" fromt eh .sh&lt;BR /&gt;&lt;BR /&gt;The activate the shell script providing whatever data is appropirate at the moment, possibly even entering lines manually:&lt;BR /&gt;&lt;BR /&gt;./test.sh &amp;lt; node_test.txt&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Mar 2006 10:13:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970096#M417706</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-03-28T10:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: Shell programing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970097#M417707</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;a simple 'ssh' will leave stdin open, so a successful connection will read all but the first value of the loop.&lt;BR /&gt;Use:&lt;BR /&gt;&lt;BR /&gt;while read host&lt;BR /&gt;do ssh -n $host&lt;BR /&gt;done &lt;HOSTS.TXT&gt;&lt;/HOSTS.TXT&gt;&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Tue, 28 Mar 2006 10:35:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970097#M417707</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-03-28T10:35:21Z</dc:date>
    </item>
    <item>
      <title>Re: Shell programing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970098#M417708</link>
      <description>Demat,&lt;BR /&gt;&lt;BR /&gt;Try to enable the public key mechanism.&lt;BR /&gt;&lt;BR /&gt;Look at this procedure and check for the following lines in sshd.conf file :&lt;BR /&gt;      RSAAuthentication yes&lt;BR /&gt;      PubkeyAuthentication yes&lt;BR /&gt;      AuthorizedKeysFile    ~/.ssh/authorized_keys&lt;BR /&gt;These lines should be uncommented.&lt;BR /&gt;&lt;BR /&gt;After this you'll be able to do : sftp/scp/ssh between this hosts without password asking.&lt;BR /&gt;&lt;BR /&gt;Another possibility for shell scripting ;&lt;BR /&gt;#!/sbin/sh&lt;BR /&gt;for SERVER in `cat hosts.txt`&lt;BR /&gt;do&lt;BR /&gt;ssh $SERVER &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;        command 1&lt;BR /&gt;        command 2&lt;BR /&gt;        command n&lt;BR /&gt;EOF&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Hope this help&lt;BR /&gt;Kenavo&lt;BR /&gt;Pat</description>
      <pubDate>Tue, 28 Mar 2006 10:40:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970098#M417708</guid>
      <dc:creator>Patrice Le Guyader</dc:creator>
      <dc:date>2006-03-28T10:40:16Z</dc:date>
    </item>
    <item>
      <title>Re: Shell programing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970099#M417709</link>
      <description>#!/usr/bin/ksh&lt;BR /&gt;# use file /tmp/host.list&lt;BR /&gt;# file name is : xxxxx&lt;BR /&gt;&lt;BR /&gt;for i in $(cat /tmp/host.list)&lt;BR /&gt;do&lt;BR /&gt; echo "do something on : $i"&lt;BR /&gt; ssh root@$i "command;command"&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Mar 2006 13:37:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970099#M417709</guid>
      <dc:creator>Jannik</dc:creator>
      <dc:date>2006-03-28T13:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: Shell programing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970100#M417710</link>
      <description>I'm a novice in shell programming.&lt;BR /&gt;Thanks to all for advices. My scrips works fine now.</description>
      <pubDate>Tue, 28 Mar 2006 21:13:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970100#M417710</guid>
      <dc:creator>Igor Sovin</dc:creator>
      <dc:date>2006-03-28T21:13:25Z</dc:date>
    </item>
    <item>
      <title>Re: Shell programing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970101#M417711</link>
      <description>Hi Igor, &lt;BR /&gt;&lt;BR /&gt;You can close this thread now. &lt;BR /&gt;&lt;BR /&gt;-Arun</description>
      <pubDate>Tue, 28 Mar 2006 22:14:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970101#M417711</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2006-03-28T22:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: Shell programing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970102#M417712</link>
      <description>have found a solution to this question as seen in the comments below.</description>
      <pubDate>Tue, 28 Mar 2006 22:17:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-programing/m-p/4970102#M417712</guid>
      <dc:creator>Igor Sovin</dc:creator>
      <dc:date>2006-03-28T22:17:44Z</dc:date>
    </item>
  </channel>
</rss>

