<?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 Script to email based on the user in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443079#M8336</link>
    <description>I am having trouble making a script to use elm to e-mail to a user some files.&lt;BR /&gt;&lt;BR /&gt;The problem is that I want to put a variable in so that the script does basically a "whoami" for the e-mail address.  That way who ever fires it off will get the message sent back to their e-mail offsite.&lt;BR /&gt;&lt;BR /&gt;Any ideas?</description>
    <pubDate>Wed, 06 Sep 2000 14:57:05 GMT</pubDate>
    <dc:creator>Mark Mitchell</dc:creator>
    <dc:date>2000-09-06T14:57:05Z</dc:date>
    <item>
      <title>Script to email based on the user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443079#M8336</link>
      <description>I am having trouble making a script to use elm to e-mail to a user some files.&lt;BR /&gt;&lt;BR /&gt;The problem is that I want to put a variable in so that the script does basically a "whoami" for the e-mail address.  That way who ever fires it off will get the message sent back to their e-mail offsite.&lt;BR /&gt;&lt;BR /&gt;Any ideas?</description>
      <pubDate>Wed, 06 Sep 2000 14:57:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443079#M8336</guid>
      <dc:creator>Mark Mitchell</dc:creator>
      <dc:date>2000-09-06T14:57:05Z</dc:date>
    </item>
    <item>
      <title>Re: Script to email based on the user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443080#M8337</link>
      <description>&lt;BR /&gt;instead you can simply add an alias to the /etc/mail/aliases file. eg; in this file put an entry;&lt;BR /&gt;root  :  &lt;EMAILADDR&gt;@&lt;DOMAIN&gt;&lt;BR /&gt;jim   :  jim@hp.com&lt;BR /&gt;then run newaliases, from now on all email to root or jim it will go to the address specificied.&lt;BR /&gt;&lt;/DOMAIN&gt;&lt;/EMAILADDR&gt;</description>
      <pubDate>Wed, 06 Sep 2000 14:59:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443080#M8337</guid>
      <dc:creator>Stefan Farrelly</dc:creator>
      <dc:date>2000-09-06T14:59:20Z</dc:date>
    </item>
    <item>
      <title>Re: Script to email based on the user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443081#M8338</link>
      <description>&lt;BR /&gt;If you want to use a script you can set a variable which is the result of a whoami command by doing;&lt;BR /&gt;USER=`whoami`&lt;BR /&gt;This will return a value such as root.&lt;BR /&gt;Then in your script you can mail something by going;&lt;BR /&gt;echo test | mailx -s"subject" $USER&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Sep 2000 15:03:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443081#M8338</guid>
      <dc:creator>Stefan Farrelly</dc:creator>
      <dc:date>2000-09-06T15:03:36Z</dc:date>
    </item>
    <item>
      <title>Re: Script to email based on the user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443082#M8339</link>
      <description>that part is already done, I am talking about a variable in the script so that it does a whoami and gets "jim" and uses it.  Then the aliases file will resolve jim to jim@hp.com and send it to the exchange server.  That way the user just has to fire off an executable in the application and the script will do the rest.</description>
      <pubDate>Wed, 06 Sep 2000 15:03:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443082#M8339</guid>
      <dc:creator>Mark Mitchell</dc:creator>
      <dc:date>2000-09-06T15:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: Script to email based on the user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443083#M8340</link>
      <description>But the mail came back as user whoami unknown</description>
      <pubDate>Wed, 06 Sep 2000 15:11:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443083#M8340</guid>
      <dc:creator>Mark Mitchell</dc:creator>
      <dc:date>2000-09-06T15:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: Script to email based on the user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443084#M8341</link>
      <description>&lt;BR /&gt;when you go&amp;gt;  USER=`whoami` &lt;BR /&gt;you must use backquotes, not forward quotes. The backquotes mean execute the command and put the results into the variable. &lt;BR /&gt;eg. after USER=`whoami`;echo $USER  I get the answer root&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Sep 2000 15:24:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443084#M8341</guid>
      <dc:creator>Stefan Farrelly</dc:creator>
      <dc:date>2000-09-06T15:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Script to email based on the user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443085#M8342</link>
      <description>Mark, it depends on if your using UNIX mail IDs with the UNIX doamin name or something like an Exchange address which may be different from your UNIX e-mail address.  &lt;BR /&gt;&lt;BR /&gt;If you want to use an e-mail address NOT corresponding to your UNIX id then use the .forward file in the home directory. Now grab the UNIX id from whoami and simply tack on your UNIX domainname.  If you have a .forward file in the home directory then UNIX will try and use it.&lt;BR /&gt;&lt;BR /&gt;If you want to use the aliases file you will have to take it one step further. If you don't use NIS, you will have to interogate the /etc/mail/aliases file or if your using NIS, interogate the aliases map with ypcat.&lt;BR /&gt;&lt;BR /&gt;Tony</description>
      <pubDate>Wed, 06 Sep 2000 15:27:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443085#M8342</guid>
      <dc:creator>Anthony deRito</dc:creator>
      <dc:date>2000-09-06T15:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: Script to email based on the user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443086#M8343</link>
      <description>The "whoami" and "who am i" will produce different outputs. &lt;BR /&gt;&lt;BR /&gt;Set the variable: export WHOISIT=`whoami`&lt;BR /&gt;cat file | mailx -s TESTING" root $WHOISIT&lt;BR /&gt;&lt;BR /&gt;You may want to be sure aliases or .forward files are in use as well.</description>
      <pubDate>Wed, 06 Sep 2000 15:37:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443086#M8343</guid>
      <dc:creator>Rick Garland</dc:creator>
      <dc:date>2000-09-06T15:37:26Z</dc:date>
    </item>
    <item>
      <title>Re: Script to email based on the user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443087#M8344</link>
      <description>Now it is starting to take shape.  The only thing is that I had to cut and paste, how did you make the backquote charicter?</description>
      <pubDate>Wed, 06 Sep 2000 16:12:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443087#M8344</guid>
      <dc:creator>Mark Mitchell</dc:creator>
      <dc:date>2000-09-06T16:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: Script to email based on the user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443088#M8345</link>
      <description>Hi,&lt;BR /&gt;You may use `whoami` in command line to refer your own user name. e.g&lt;BR /&gt;elm -s Testing Mail `whoami' &amp;lt; /tmp/mailfile&lt;BR /&gt;&lt;BR /&gt;Punjabhai V Patel&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Sep 2000 16:36:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443088#M8345</guid>
      <dc:creator>P V Patel</dc:creator>
      <dc:date>2000-09-06T16:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: Script to email based on the user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443089#M8346</link>
      <description>The backquote char is the one below the ~ character usually in the top left corner</description>
      <pubDate>Sun, 10 Sep 2000 23:50:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443089#M8346</guid>
      <dc:creator>Anthony Goonetilleke</dc:creator>
      <dc:date>2000-09-10T23:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: Script to email based on the user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443090#M8347</link>
      <description>Here is a perl version of it ...&lt;BR /&gt;&lt;BR /&gt;#!/bin/perl &lt;BR /&gt;# This should match the mail program on your system.&lt;BR /&gt;$mailprog = '/usr/lib/sendmail';&lt;BR /&gt;$recipient = 'youremail@yourdomain.com';&lt;BR /&gt;$email = 'bob@hp.com';&lt;BR /&gt;&lt;BR /&gt;# Now send mail to $recipient&lt;BR /&gt;open (MAIL, "|$mailprog $recipient") || die "Can't open $mailprog!n";&lt;BR /&gt;print MAIL "From: $emailn";&lt;BR /&gt;print MAIL "Subject: ITRCnn";&lt;BR /&gt;close (MAIL);</description>
      <pubDate>Mon, 11 Sep 2000 00:50:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443090#M8347</guid>
      <dc:creator>Anthony Goonetilleke</dc:creator>
      <dc:date>2000-09-11T00:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: Script to email based on the user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443091#M8348</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;if you use posix shell (/sbin/sh) or korn shell (/usr/bin/ksh) you can do:&lt;BR /&gt;USER=$(whoami)&lt;BR /&gt;this will put the output of the executable whoami into the variable USER.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;&lt;BR /&gt;Andrew</description>
      <pubDate>Mon, 11 Sep 2000 07:00:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443091#M8348</guid>
      <dc:creator>Andreas Voss</dc:creator>
      <dc:date>2000-09-11T07:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: Script to email based on the user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443092#M8349</link>
      <description>Mark, &lt;BR /&gt;&lt;BR /&gt;on a USASCII you find a backquote ` left of "1", a singlequote ' left of enter.&lt;BR /&gt;on a SwissGerman backquote is Shift+ left of backspace, singlequote one more to the left.&lt;BR /&gt;&lt;BR /&gt;RGDS&lt;BR /&gt;Thomas</description>
      <pubDate>Mon, 11 Sep 2000 11:34:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443092#M8349</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-09-11T11:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: Script to email based on the user</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443093#M8350</link>
      <description>Thanks everyone, I wanted to create a script that would e-mail you the result to Microsoft exchange.  I basically use the etc/aliases to resolve the name.  Here is the working version.  I created the wri file because I wanted the output to open in Wordpad first so users didn't have to figure it out. I know that it looks dirty, but I am still working on it.&lt;BR /&gt;&lt;BR /&gt;USER=`whoami` &lt;BR /&gt;cp report.wri ~/report.wri&lt;BR /&gt;&amp;lt; ~/report.wri&lt;BR /&gt;pg $1 &amp;gt; ~/report.wri&lt;BR /&gt;&lt;BR /&gt;if [ ! -d ~/Mail ]; then&lt;BR /&gt;  mkdir ~/Mail&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;if [ ! -d ~/.elm ]; then&lt;BR /&gt;  mkdir ~/.elm&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;#!usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;echo "[include ~/report.wri application/octet-stream base64]" | &lt;BR /&gt;  elm -s "report " $USER&lt;BR /&gt;                                                                 &lt;BR /&gt;</description>
      <pubDate>Wed, 13 Sep 2000 13:38:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-email-based-on-the-user/m-p/2443093#M8350</guid>
      <dc:creator>Mark Mitchell</dc:creator>
      <dc:date>2000-09-13T13:38:48Z</dc:date>
    </item>
  </channel>
</rss>

