oddity regarding execution
I am using FreeBSD and sendmail to work on the internet. Recently I wrote a program to process a incoming email and append it to a file in it's own directory. I have a complete email in a file in the directory for testing, and I fired it up from the command line prompt using input redirection to draw input from the file; it worked fine. So I created an alias pointed at it, and fired off a test message. Well, when the alias fed the message to it, it barked. 'unknown mailer error 1' says the log. Ran it with the sample file, worked fine; even modified the testcase a little, still fine. H... So I added a line to the script, so it would open a file and write it's current path, and very carefully detailed EXACTLY where this file lived, having a suspicion. BARK! Although it still barked like a dog, it gave me my confirmation; when executed by an alias, it thinks the cwd is '/'!!! I modified the script to point EXACTLY to the location of the recipient file of the data, and all was now well, either way. HHM. is this a freebsd quriosity, a sendmail quriosity, or what all? And is there anything I can do so the cwd will be the dir the script is living in? -- end Cheers! Kirk D Bailey think http://www.howlermonkey.net/ +-+ http://www.tinylist.org/ http://www.listville.net/| BOX | http://www.sacredelectron.org/ +-+ Thou art free-ERIS think'Got a light?'-Promethieus Fnord. ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: oddity regarding execution
Kirk Bailey [EMAIL PROTECTED] wrote: Well, when the alias fed the message to it, it barked. 'unknown mailer error 1' says the log. Ran it with the sample file, worked fine; even modified the testcase a little, still fine. H... So I added a line to the script, so it would open a file and write it's current path, and very carefully detailed EXACTLY where this file lived, having a suspicion. BARK! Although it still barked like a dog, it gave me my confirmation; when executed by an alias, it thinks the cwd is '/'!!! I modified the script to point EXACTLY to the location of the recipient file of the data, and all was now well, either way. HHM. is this a freebsd quriosity, a sendmail quriosity, or what all? And is there anything I can do so the cwd will be the dir the script is living in? Actually, this is just the way shell scripts work. If you run your script from another directory, specifying the full path, the shell will not change to the directory containing the script (unless the script does this). -NWR ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: oddity regarding execution
On Sun, 6 Jul 2003 04:56, Kirk Bailey wrote: I am using FreeBSD and sendmail to work on the internet. Recently I wrote a program to process a incoming email and append it to a file in it's own directory. I have a complete email in a file in the directory for testing, and I fired it up from the command line prompt using input redirection to draw input from the file; it worked fine. So I created an alias pointed at it, and fired off a test message. Well, when the alias fed the message to it, it barked. 'unknown mailer error 1' says the log. Ran it with the sample file, worked fine; even modified the testcase a little, still fine. H... So I added a line to the script, so it would open a file and write it's current path, and very carefully detailed EXACTLY where this file lived, having a suspicion. BARK! Although it still barked like a dog, it gave me my confirmation; when executed by an alias, it thinks the cwd is '/'!!! I modified the script to point EXACTLY to the location of the recipient file of the data, and all was now well, either way. HHM. is this a freebsd quriosity, a sendmail quriosity, or what all? And is there anything I can do so the cwd will be the dir the script is living in? Normal: the thought of scripts setting current directory by default is horrific! You can use something like: #!/bin/sh cd `dirname $0` pwd Malcolm Kay ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]