Automator returns different BASH script result than Terminal-

Hello all,
I didn't find an Automator section for OS X 10.6, so I hope this is the proper place to post a question.
Objective:
Right-click on a file, have a Workflow return a TextEdit document or the ClipBoard with the SHA1 hash for that file. I want to bypass opening Terminal every time I have to verify a file's SHA1 hash.
Difficulty:
The SHA1 output from Workflow is not the same as the SHA1 output from the Terminal. Both cases are supposed to run this command:
/usr/bin/openssl sha1 <path and name of file>
Steps taken:
So far, I created a simple Workflow as follows:
Get Selected Finder Items
New TextEdit Document
Run (bash) Shell Script (to stdin): /usr/bin/openssl sha1 $1
Set Contents of TextEdit Document (Appending)
The output from the Workflow looks like this:
4313214a162ed89e5180a7c47a8b0fe2e17801bd
The Terminal output looks like this:
SHA1(Screen shot 2010-03-31 at 2.35.08 PM.png)= 525cf5fb1f6e124a24cb4282a09851ca94d177ba
It is clear that these two hashes are not the same. What I don't get is, why?
Any help here would be greatly appreciated.

Just so others can also benefit from my efforts, I have found the solution and wanted to share.
The Workflow should look like this:
New TextEdit Document
Get Selected Finder Items
Run (Bash) Shell Script (as arguments)
Set Contents of TextEdit Document
The bash shell script should look like this:
/usr/bin/openssl sha1 "$@"; echo "" 2>&1
/usr/bin/openssl sha "$@"; echo "" 2>&1
/usr/bin/openssl md5 "$@"; echo "" 2>&1
/usr/bin/openssl md4 "$@" 2>&1
This will make a very nice output that looks like this:
SHA1(/Users/andrew-grant/Desktop/Home Budgets.fp7)= 59b35dec0dacf9c5f85ec86ded20c385bdc69f30
SHA1(/Users/andrew-grant/Desktop/CHKTAPE.LZW)= 8adf0dd993569c576cfbc1a973e5f3bc2e21533a
SHA(/Users/andrew-grant/Desktop/Home Budgets.fp7)= e9ed0f4a006262ab364069b455e459052e909cab
SHA(/Users/andrew-grant/Desktop/CHKTAPE.LZW)= 01fde6202b0df4d7d8a3f726a5d7681ffc3863ee
MD5(/Users/andrew-grant/Desktop/Home Budgets.fp7)= 01ab9a63aea217fa0ee11a28a4d23eeb
MD5(/Users/andrew-grant/Desktop/CHKTAPE.LZW)= b388e3333a84fe3e821f7c4e1f236950
MD4(/Users/andrew-grant/Desktop/Home Budgets.fp7)= ef2746d7f3fd41f1846fe950ea79a856
MD4(/Users/andrew-grant/Desktop/CHKTAPE.LZW)= 9db75e3347e5e5b446e54b7b883e558d
I hope this helps the next person looking for something similar.

Similar Messages

  • External system returned different number of lines than received error

    Hi,
    While posting invoice in MIRO,i am getting the following error,
    "External system returned different number of lines than received"
    Please help in resolving this error.
    Thanks
    Srini

    Hi,
    Can you please check this sap note..
    Note 1499319 - Ext system returned different number of lines than received
    Regards

  • Run bash script other than from terminal?

    Hi,
    I have a small 2 line script that runs an application...I want to create an icon to double-click to run the 2 lines and start the app, so I don't have to open Terminal and type the 2 lines.
    I've used Automator to create an app to do this, but in the task bar I see "run shell script" and the rotating wheel-thingy the whole time the app is open.
    Is there any way to create a script/app to do this without having "run shell script" and the rotating wheel-thingy going on?
    Cheers,
    Nige

    Hmm, why does the word "Platypus" keep running through my head?
    Bob, I'm trying to do the same thing (create a .app to launch a unix application) and I also ran into the aesthetic issue of the spinning gear in the menu bar for the entire time the app was running. Since the unix app I'm running is a Usenet news reader, that spinning gear would be a long-term distraction. I'll check out Platypus, but I and probably the others in this thread are trying to learn how to do this stuff ourselves to further our OS X knowledge, not merely to solve this one problem.
    So with that being said, does anyone know if there's a way to create an Automator "Run Shell Script" action with that spinning gear in the menu bar suppressed? You know, besides using Platypus.

  • Select statement returns different results from 9i and 10g

    Hi all,
    Would appreciate if someone could help to solve this puzzle here:
    I have the exact the statements running on Oracle 9i and 10g, why do they return different results?
    Select unique(GroupDesc) , GroupSeq from Module where ModuleId in (Select ModuleId from User_Access where UserId='admin') and Status='A'
    In Oracle 9i:
    Both columns returned as follows...
    GroupDesc | GroupSeq
    In Oracle 10g:
    Only one column returned, the column with unique keyword was missing...
    GroupSeq
    Could anyone enlighten me?

    yes, the table structure... actually the CREATE TABLE statement...
    with some sample data (INSERT INTO)
    and the actual queries (both of them - copy-paste them from each separate environment)
    you can use tags around the statements this will format it to a fixed font - making it easier to read
    Edited by: Alex Nuijten on Feb 20, 2009 10:05 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • To_char(adate,'dd.mm.yyyy')   returns different results  from  two oracle clients !!! Is it  possible?

    Dear all;
    We have only one Database server with some IIS's   as web servers on front . Each web server has own oracle client software in order connect to central database..
    The same following query used in C#  code  returns different results on each IIS server.(3 row, or  not data found )
    why?
    select     *    from    aTable    where        to_char( adate ,  'dd.mm.yyyy' )  =   :search_date
    regards
    Siya

    1006237 wrote:
    If adate is of DATE datatype, it will most likely has the time component. Therefore your SQL below is unlikely to return any data.
    select * from aTable where adate = to_date(:search_date, 'dd.mm.yyyy')
    Perhaps.....
    select * from aTable where TRUNC(adate) = to_date(:search_date, 'dd.mm.yyyy')
    Hi,
    not having any sample data from you I could not understand that you wanted to select the range 00:00:00 - 23:59:59 on search_date.
    Your method might not be efficient if you have an index on adate.
    Maybe something like this will be more efficient
    select * from aTable
    where adate >= to_date(:search_date, 'dd.mm.yyyy')
      and adate <  to_date(:search_date, 'dd.mm.yyyy') + 1;
    If you search_date is 30-Aug-2013 it will get records where adate >= 30-Aug-2013 00:00:00 and adate < 31-Aug-2013 00:00:00, so any time of date 30-Aug-2013.
    Try like this and let us know if you still have 2 different results.
    Regards.
    Alberto

  • Returning Different Results Based on Input Criteria

    I have a complex nested select statement. Based on selection criteria I want to return different results. Say for instance I had an input parameter Called Products which could contain a Yes/No Flag. If the Flag was Yes then I would want the "top" select, statement to be The following:
    Select Product, Time_ID, Amt
    From
    My Complex Nested Select
    But if Product was set to "No", I would want the following:
    Select Time_ID, Amt
    From
    My Complex Nested Select
    I know, or course that I can have two COMPLETE set of SQL which are invoked based upon testing the value of the PRODUCT Parameter, but If I duplicate the "inner nested select" then I have 2 sets of select staments to maintain. Is there an alternative to this? Could I make the inner portion which does not change a function of some sort so that my code would look something like this?
    Select Product, Time_ID, Amt
    From
    Execute myNestedSelectFunction
    But if Product was set to "No", I would want the following:
    Select Time_ID, Amt
    From
    Execute myNestedSelectFunction
    This would atleast ensure that I only have to go one place to maintain the logic of the "static Nested Select" statement.
    Just want to make sure I do not have a real viable alternative to "duplicating code"
    Thanks

    Hi,
    Look in TFM for PIPELINED functions which will allow you to:SELECT Product, Time_ID, Amt FROM TABLE(myPipelinedFunctionReturningSelectResult()) T;
    SELECT Time_ID, Amt FROM TABLE(myPipelinedFunctionReturningSelectResult()) T;There are samples if you look on AskTom too.
    Regards,
    Yoann.

  • Bash script to terminated upon logout,

    Hi all,
    I have created a bash script - which start recording a camera device for security purpose, but I need the script to finish when the security user is logging out.
    Any idea on how to do that?

    sweetthdevil wrote:
    Hi again,
    sorry it took some time but I haven't had the time to look yet,
    Back to the topic, I added the "pkill mencoder" at the begining of the file but it doesn't seem to work (because when shutting down the pc, the avi file created is broken - the index)
    Any suggestion?
    Difficult to say like this. If you kill mencoder by hand (not with the logout script); does this work properly? Maybe you have to wait that men,coder actualy exit before continuing:
    PID=$(grep mencoder)
    kill $PID
    wait $PID
    (work only if there is a single mencoder process).
    But how did you start mencoder? (o processes receive a HUP signal if the terminal from which it has been opened is closed).
    Last edited by olive (2011-03-04 00:58:30)

  • JNDI returns different results local vs. remote?

    I cannot get the Sun Application Server 8.1 to provide access to EJBs from an independant Tomcat. The server does seem to provide access to the EJB remote interfaces when the client war file is deployed within the SAS-internal web container. In trying to debug this problem, I have noticed that JNDI returns different objects in the two cases, even though the client in both cases is making a "remote" call to IIOP port 3700 to get the JNDI info!
    When run within the SunAppServer internal web container, JNDI returns objects of type:
    <package name>._<BeanName>RemoteHome_DynamicStub
    (e.g. in my case com.aa.ejb._BusinessRemoteHome_DynamicStub for a bean named "Business")
    However, when the same .war is deployed on an independant Tomcat running on the same machine, JNDI returns objects of type:
    com.sun.corba.se.impl.corba.CORBAObjectImpl
    Is this normal? Is there some way that I should be getting the DynamicStubs delivered to the remote clients?
    I wouldn't be worried about this except that the PortableRemoteObject.narrow() method returns null when I try to use it on the CORBAObjectImpl references.
    The relevant parts of my code are:
    p.put( Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.cosnaming.CNCtxFactory" );
    p.put( Context.PROVIDER_URL, "iiop://localhost:3700" );
    //?? Note: this works the same whether I use "localhost" or my actual IP address.
    String objName = "ejb/Business";     
    InitialContext initial = new InitialContext(p);
    out.println("<P>Looking up objName="+objName);
    Object objref = initial.lookup(objName);
    out.println("<P>objref="+objref);
    out.println("<br>objref class="+objref.getClass().getName());
    //?? When run in the SAS-internal web container, this displays:
    //?? com.aa.ejb._BusinessRemoteHome_DynamicStub
    //?? When run in a separate Tomcat, this displays:
    //?? com.sun.corba.se.impl.corba.CORBAObjectImpl
    BusinessRemoteHome home =
    (BusinessRemoteHome)PortableRemoteObject.narrow(objref,
              BusinessRemoteHome.class);
    //?? When run in the SAS-internal web container, this works correctly.
    //?? When run in a separate Tomcat, this returns null!

    Okay - a good night's sleep helped. Found the solution:
    Properties props = new Properties();
    props.setProperty(Context.PROVIDER_URL, "iiop://localhost:3700");
    props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.sun.appserv.naming.S1ASCtxFactory");
    Context ctx = new InitialContext(props);
    Object ref = ctx.lookup("ejb/someEJB");
    etc.Hope this helps.
    Cheers
    Keith

  • Returning Different Results for the  Same Search Value

    I'm creating a word list and I'm using Lookup to find text entries in column D and return values from column A. I can manage one result based on the search criteria however I'm wondering if it's possible to return multiple entries from column A if multiple matches are found in column D:
    As you can see I'm trying to use the formula =LOOKUP("Aggression",D,A) to find all the instances of "Aggression" in column D and return all the corresponding results from column A (audacious, barefaced, and depredation). Lookup however only returns the last match (depredation).

    I wish you'd shown where your LOOKUP function is located and what you're trying to do with it. Are you going to be using these results in another function? Or are you simply wanting to display the results of your search?
    If the latter, there's an elegant way to make this happen. Let's create a single-cell table on the same page, holding the word you're searching for. (Ideally, this could be a drop-down list -- and that can be made to dynamicly hold all the discrete values in column D -- but that's another discussion.) Let's call this table "Search".
    Add a column (which can be hidden) to your original table. Let's insert this next to your column D, making it column E. Cell E2 contains =IF($D2=Search :: $A$1,TRUE,FALSE). Drag/copy that down the column. You'll now have a value of TRUE in this column for all the words you're looking for. Now click on the top of this column E and click "Show More Options".... and click on "Show rows that match the following". Set it to show where Column E is true. You now show only the words in which the "category" matches the search word.
    Change the word in your Search table, and the display of your original table automatically adjusts.
    The nice part is that the entire line is displayed so you can see definitions and contexts as well.
    Vince

  • Cdrip - my cd ripping automation bash script

    Some time ago, I wrote a bash script to automate the ripping, encoding, and organization process for my cd collection. I hadn't used it in a while, but recently `axion asked to have a copy, which led me to realize that it was broken in bash 3. So I rewrote it, incorporating some new ideas I had.
    Similar projects, like abcde, act more like a frontend for specific tools, whereas CDRip can use any tool at all. You can even set it up to automatically perform filters using sox, burn backups of your albums, or upload files to your jukebox server's ftp once the ripping is complete.
    Anyway, I ended up starting a project on sourceforge, including some nice documentation for configuring the script, and I thought this is a perfect time to make an Arch Linux package!
    PKGBUILD
    pkgname=cdrip
    pkgver=0.5.1
    pkgrel=1
    pkgdesc="An extremely customizable CD ripping script. Looks up album info with FreeDB. Supports any cmdline ripper, encoder, tagger, etc..."
    url="http://cdrip.sourceforge.net/"
    license="GPL"
    depends=('bash' 'wget' 'cd-discid')
    backup=(etc/cdrip.conf)
    source=(http://dl.sourceforge.net/sourceforge/cdrip/$pkgname-$pkgver.tar.gz)
    md5sums=('d0eda52556b321e6b4070a95c82b783e')
    build() {
    cd $startdir/pkg
    mkdir -p usr/bin etc
    mv $startdir/src/$pkgname-$pkgver/cdrip usr/bin
    mv $startdir/src/$pkgname-$pkgver/cdrip.conf etc
    chmod 755 usr/bin/cdrip
    chmod 644 etc/cdrip.conf

    i used rip for my ripping encoding when i was using linux for ripping.

  • Why does do shell work differntly from running the same bash script in terminal?

    i have the following a/s:
    set scriptPath to quoted form of ((POSIX path of (path to me)) & lnThumb)       set ftn to ""       repeat            try                 do shell script scriptPath & " " & ppath & " " & ftn                 exit repeat            on error error_message number error_number                  if error_number is not -128 then                      set ftn to (choose file with prompt "select folder thumbnail" default location dir without invisibles)                      set ftn to quoted form of the POSIX path of ftn                 end if            end try       end repeat
    calling this bash script:
    #!/bin/bash -f   cd "$1"  rm ./folderthumb.jpg   if [ $# -gt 1 ]  then      ft=${2/#"$1"\//}  else      ft=$(awk '/folderIcon=/{printf("%s",$1)}' meta.properties  | sed s/folderIcon=// )      if [ 0$ft -eq 0 ]       then          exit 1      fi      ft="thumbs/"$ft  fi  ln -s $ft ./folderthumb.jpg  exit 0
    which works as expected when run from the cli:
    tomw> /Applications/imageProc/fixJAlbum.app/Contents/Resources/Scripts/lnThumb.sh `pwd` `pwd`/thumbs/P1040161.JPG   tomw> ls -l folderthumb.jpg lrwxr-xr-x  1 tomw  admin  19 Oct 22 10:36 folderthumb.jpg -> thumbs/P1040161.JPG
    but fails to strip the common directory when called from do shell:
    tomw> ls -l folderthumb.jpg   lrwxr-xr-x  1 tomw  admin  89 Oct 22 10:36 folderthumb.jpg -> /Users/tomw/Desktop/trip2albequerque/albequerque/oldRailyards2nobHill/thumbs/P1 040133.JPG
    w-t-f???

    Click on the "Use Advanced editor" on the upper Right of the edit box.
    Select the text you want preserved
    Click on the >> icon then select "Syntax Highlighting" -> "Plain"
    And you will get this
       kind of
    output    when    you     post

  • Bash script for checking link status

    So I'm doing some SEO work I've been tasked with checking a couple hundred thousand back links for quality.  I found myself spending a lot of time navigating to sites that no longer existed.  I figured I would make a bash script that checks if the links are active first.  The problem is my script is slower than evolution.  I'm no bash guru or anything so I figured maybe I would see if there are some optimizations you folks can think of.  Here is what I am working with:
    #!/bin/bash
    while read line
    do
    #pull page source and grep for domain
    curl -s "$line" | grep "example.com"
    if [[ $? -eq 0 ]]
    then
    echo \"$line\",\"link active\" >> csv.csv else
    echo \"$line\",\"REMOVED\" >> csv.csv
    fi
    done < <(cat links.txt)
    Can you guys think of another way of doing this that might be quicker?  I realize the bottleneck is curl (as well as the speed of the remote server/dns servers) and that there isn't really a way around that.  Is there another tool or technique I could use within my script to speed up this process?
    I will still have to go through the active links one by one and analyze by hand but I don't think there is a good way of doing this programmatically that wouldn't consume more time than doing it by hand (if it's even possible).
    Thanks

    I know it's been awhile but I've found myself in need of this yet again.  I've modified Xyne's script a little to work a little more consistently with my data.  The problem I'm running into now is that urllib doesn't accept IRIs.  No surprise there I suppose as it's urllib and not irilib.  Does anyone know of any libraries that will convert an IRI to a URI?  Here is the code I am working with:
    #!/usr/bin/env python3
    from threading import Thread
    from queue import Queue
    from urllib.request import Request, urlopen
    from urllib.error import URLError
    import csv
    import sys
    import argparse
    parser = argparse.ArgumentParser(description='Check list of URLs for existence of link in html')
    parser.add_argument('-d','--domain', help='The domain you would like to search for a link to', required=True)
    parser.add_argument('-i','--input', help='Text file with list of URLs to check', required=True)
    parser.add_argument('-o','--output', help='Named of csv to output results to', required=True)
    parser.add_argument('-v','--verbose', help='Display URLs and statuses in the terminal', required=False, action='store_true')
    ARGS = vars(parser.parse_args())
    INFILE = ARGS['input']
    OUTFILE = ARGS['output']
    DOMAIN = ARGS['domain']
    REMOVED = 'REMOVED'
    EXISTS = 'EXISTS'
    NUMBER_OF_WORKERS = 50
    #Workers
    def worker(input_queue, output_queue):
    while True:
    url = input_queue.get()
    if url is None:
    input_queue.task_done()
    input_queue.put(None)
    break
    request = Request(url)
    try:
    response = urlopen(request)
    html = str(response.read())
    if DOMAIN in html:
    status = EXISTS
    else:
    status = REMOVED
    except URLError:
    status = REMOVED
    output_queue.put((url, status))
    input_queue.task_done()
    #Queues
    input_queue = Queue()
    output_queue = Queue()
    #Create threads
    for i in range(NUMBER_OF_WORKERS):
    t = Thread(target=worker, args=(input_queue, output_queue))
    t.daemon = True
    t.start()
    #Populate input queue
    number_of_urls = 0
    with open(INFILE, 'r') as f:
    for line in f:
    input_queue.put(line.strip())
    number_of_urls += 1
    input_queue.put(None)
    #Write URL and Status to csv file
    with open(OUTFILE, 'a') as f:
    c = csv.writer(f, delimiter=',', quotechar='"')
    for i in range(number_of_urls):
    url, status = output_queue.get()
    if ARGS['verbose']:
    print('{}\n {}'.format(url, status))
    c.writerow((url, status))
    output_queue.task_done()
    input_queue.get()
    input_queue.task_done()
    input_queue.join()
    output_queue.join()
    The problem seems to be when I use urlopen
    response = urlopen(request)
    with a URL like http://www.rafo.co.il/בר-פאלי-p1
    urlopen fails with an error like this:
    Exception in thread Thread-19:
    Traceback (most recent call last):
    File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/threading.py", line 639, in _bootstrap_inner
    self.run()
    File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/threading.py", line 596, in run
    self._target(*self._args, **self._kwargs)
    File "./linkcheck.py", line 35, in worker
    response = urlopen(request)
    File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/urllib/request.py", line 160, in urlopen
    return opener.open(url, data, timeout)
    File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/urllib/request.py", line 473, in open
    response = self._open(req, data)
    File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/urllib/request.py", line 491, in _open
    '_open', req)
    File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/urllib/request.py", line 451, in _call_chain
    result = func(*args)
    File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/urllib/request.py", line 1272, in http_open
    return self.do_open(http.client.HTTPConnection, req)
    File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/urllib/request.py", line 1252, in do_open
    h.request(req.get_method(), req.selector, req.data, headers)
    File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/http/client.py", line 1049, in request
    self._send_request(method, url, body, headers)
    File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/http/client.py", line 1077, in _send_request
    self.putrequest(method, url, **skips)
    File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/http/client.py", line 941, in putrequest
    self._output(request.encode('ascii'))
    UnicodeEncodeError: 'ascii' codec can't encode characters in position 5-8: ordinal not in range(128)
    I'm not too familiar with how character encoding works so I'm not sure where to start.  What would be a quick and dirty way (if one exists) to get URLs like this to play nicely with python's urlopen?

  • Sending email using bash script

    Hello:
    I am working on writing a bash script to notify one or more users by email of certain events. Run from the Terminal command line, and having the script "echo" text of (what would be) a form letter with in-line variable expansion (i.e., ${VARIABLE}), all seems to work as anticipated. Eventually, I want cron to launch this shell script, and send an email to an "on-subnet" user (I have postfix enabled on my Mac, and there are multiple local user accounts).
    I found some stuff on the web about sending mail from bash scripts, and so I made a small little test script, that reads like this:
    #!/bin/bash
    VARIABLE[1]="The 12,345 quick brown foxes "
    VARIABLE[2]="jumped over the 67,890 lazy dogs."
    mail -s "a test email" jv << EOF
    This is a test:
    ${VARIABLE[1]}
    ${VARIABLE[2]}
    This is the last line of the test message.
    EOF
    echo "script completed"
    It worked... almost... It sent a local email to my postfix mail account that read like this:
    This is a test:
    The 12,345 quick brown foxes
    jumped over the 67,890 lazy dogs.
    This is the last line of the test message.
    EOF
    echo "script completed"
    So, I have two questions. First, the easy one (I hope):
    How do I delimit the end of the text, that I want to be the message body of the email, from portions of the script that follow said email text?
    Next question is a little more involved. You know how, in Mail.app, if you go to Mail Preferences>Accounts>Account Information, you can put multiple email addresses, comma-delimited, in the "Email Address" field? So, if a person entered "[email protected], [email protected], [email protected]" in this field, then, even though (s)he may be at home, and using their home ISP's mail server, (s)he could send an email apparently from either their home, work, or school email address. Of course, the mail headers clearly would show it came from and through their home machine and home ISP, but it would be displayed in the recipient's Mail client viewer as having come from one of [email protected], [email protected], or [email protected].
    I'd like to do something similar here, whereby the email (that is being sent to one or more local users' postfix account on my computer) would apparently be sent from "watchdog@localhost" rather than from "jv@localhost" like it seems to do by default. Whatever account the script is run from (or presumbably, whose cron tab is launching the script) is what the "From" address is set to.
    I'd rather not create an additional mail account, because I am using Mac OS X built-in accounts for the postfix mailboxes (I don't want to have to maintain a plaintext username:password file in postfix, and I don't want to create an additional user account on the computer).
    So, is there a way to specify an alternate "From" username when invoking the mail -s ${SUBJECT} ${RECIPIENT} command in a bash script? Or is there a different, alternate mail command that will let me do so? (please include a description of syntax and how I'd package the above message text for the alternate method).
    Thanks in advance, all!

    Hi j.v.,
    The > after EOF is just a typo (or may be added by the Discussion ?) and you must delete it; other > are prompts from the interactive shell. Andy's post shows an interactive use of shell, not a shell script (note the shell prompt % in front of the commands). A typical use of here document may look like
    command <<ENDOFDATA
    ENDOFDATA
    There must be no spaces before and after ENDOFDATA. The word ENDOFDATA can be EOF or any other string which is guaranteed not to appear in the text (the .... in the example above).
    You can modify the From: header by using sendmail command (postfix has it as a compatibility interface):
    /usr/sbin/sendmail -t <<EndOfMessage
    Subject: test mail
    To: jv
    From: watchdog
    This is a test:
    ${VARIABLE[1]}
    ${VARIABLE[2]}
    This is the last line of the test message.
    EndOfMessage
    There must be a blank line between the headers and the mail body.
    I assume that you send these mails only to users on your local Mac. Please do not send mails to remote users by using the sendmail command unless you know what you are doing completely.
    PowerMac G4   Mac OS X (10.4.5)  

  • Newb bash script

    Well I've had linux for about a year or so now....Well I suppose longer than that but I didn't use it for a while but here I am full time user of Linux for about a year now, wahoo!
    Anyways, I suppose its time to dabble into some coding so I can understand those pesky pkgbuilds when I wanna change them...
    Basically right now I have the linux client Team Fortress 2 dedicated server installed and it has a command to run which starts the script.  I made a script in /usr/bin that I can call on quickly with just 'tf2server' to fire up the server when I want.  It already has the options in that script such as the players and which map to load.
    ./srcds_run -game tf +maxplayers 5 +map
    is basically the line that it calls. What I want to do though is instead of having to go to the folder where it is and running that command with different options when I want to each time I'd like to be able to just do something like...
    tf2server cp_well
    for example, and then it would use well for the map.  I know that in terminal you can type --help on most commands and it will show you usage, so basically my question is....Is there a guide, or someone willing to give an example on how I can accomplish this? I'm assuming it will only take bash and some wildcards of some kind to do.
    Help is appreciated

    SiegeMachine wrote:./srcds_run -game tf +maxplayers 5 +map
    Unless your script is explicitly cd'ing into the directory for 'srcds_run', then attempting to invoke the command found in the current directory is probably not what you want.  If this is the case, I'd either have the script change to the correct directory itself, or ensure the path to srcds_run is in your $PATH and remove the leading "./".  When running a script, the current directory is that which the script was invoked from and not that which the script is located.
    To accept options as in your example is quite simple:
    ./srcds_run -game tf +maxplayers 5 +map $@
    $@ evaluates to the argument(s) specified.  So, assuming the '+map' option takes the name of a map as an argument:
    tf2server cp_well
    Should work fine.  With this you can also specify any additional settings for the server.  E.g.,:
    tf2server cp_well +timelimit 30
    (Note: I know nothing about Team Fortress. '+timelimit' probably doesn't exist; I'm just making things up )
    If you're interested in learning shell scripting, Advanced Bash Scripting (PDF) is an excellent resource.
    Hope this helps.
    Last edited by chpln (2009-12-17 09:54:15)

  • How to prevent Automator's "run shell script" to create fully decomposed forms of my strings ?

    I am using Automator's "run shell script" and I am seeing that it outputs fully decomposed forms of my strings.
    For example, when I set the action to "echo été" in a service (with "Replace selected text" activated) and run that into a Textwrangler window, I'll get fully decomposed forms that Textwrangler won't understand. But when I simply type that command into Terminal, I get my string in composed form.
    The problem is not the display issue, but the fact that if I want to run grep for example in "run shell script", I will not be able to find the proper strings since the forms are different.

    Originally I was using $@ to parse a string and get the result pasted by the service. That was a while ago. There, I noticed that some Japanese characters were messed up. Basically all the kana characters that come with voicing markers like が-ga (instead of か-ka) etc. I did not have the time to pursue that issue though.
    Then, last night, I found that a colleague of mine had tried to use $@ to feed to a local dictionary application called ding (http://ftp.tu-chemnitz.de/pub/Local/urz/ding/). His problem was with characters that had umlauts. After verifying how he wrote his action I remembered that I had similar issues with Japanese.
    Basically his command was "/path/to/ding $@"
    That's supposed to use the selected string as an argument to pass to ding, which will launch a Wish application where the string is used as the searched item.
    From Terminal, that works a treat. But the exact same line in Automator (with input as argument, not as stdin) messed the composition and the resulting string was not recognized by ding as a match to what it was supposed to match.
    So, I tried a few things to get to the core of the issue and found that a simple "echo [accented characters]" was enough to reproduce the difference in string handling between Automator and Terminal. That difference is also reproduced on a number of person's machines.
    I have a number of services that basically revolve on "run shell script" actions and involve 3rd party application outputs, preference files etc. so it would not be convenient to show that to you.
    I have sent a mail about this issue to the automator list yesterday too:
    http://lists.apple.com/archives/Automator-users/2011/Jun/msg00004.html

Maybe you are looking for

  • Gnome 3.4 - automount broken [SOLVED]

    Hello! With Gnome 3.4 automount doesn't work anymore with my custom kernel. This worked before without any problem. It seem to me, that this caused by my kernel configuration and a change by udisks/udisks2. $ groups lp games network video audio stora

  • Set filename for file download

    Hi i have a servlet that sends a file to the client to be downloaded. When the client requests the file the dowload dialogue pops asking if the user wants to download/open but the name of the file is always the servlet name were it originates. Is the

  • How to create a button on a form that automatically creates a new page or form with pre-filled field

    I'm trying to create an advanced workorder for my company.  In short, I need to have a summary page that includes pertinent contact and matter information but then have the users have the ability to essentially click a button and have it auto-generat

  • I just cant get this iPod to sync my iPhoto library

    Hey, I am getting kinda frustrated here...I am able to sync my music and so on, but when I try to sync my iphoto library I get ( THIS IPOD CANNOT BE SYNCED, REQUIRED FILES CANNOT BE FOUND ) .. mind you, when I sync photo's from my picture album, ever

  • Pass through camera, looking to buy. Suggestions?

    Hi, I'm looking to streamline how I make videos. I've tried using iMovie with a Canon Vixia HF200. But couldn't get the video from the card. I maxed out my RAM to 8 GB, put in a 1TB drive and still didn't work. I did the trial of FCP and while that m