DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43748>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43748


[EMAIL PROTECTED] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|other                       |SunOS
   Target Milestone|2.0.1                       |1.2.6




------- Additional Comments From [EMAIL PROTECTED]  2007-12-11 16:38 -------
The goal of my revision to lenya.sh is to make LENYA_HOME independent
of an environment variable.  Before this change, running any of these
files:
  /lenya-1.2.2/lenya.sh
  /lenya-1.2.5/lenya.sh
  /lenya-1.2.x/lenya.sh
will start the same instance of Lenya because the environment variable
overrides the path of the command.  This is not intuitive.  Running
/lenya-1.2.5/lenya.sh should launch Lenya 1.2.5, not Lenya
1.2.2.  More critical, running multiple instances of Lenya is not
possible when the launch command always reverts to a single instance.
Editing lenya.sh in each instance to hardcode the directory
violates every rule of computing.

In ash, bash, csh, ksh, and every shell except the original 1977 sh,
${0%/*}
will remove the last slash and anything after the last slash from the command.

echo $0
returns
-bash
because echo is integral to bash so the "command" is bash.  Test using
the following script.

FILE: test.sh
#!/bin/sh
echo "PWD= `pwd`"
LENYA_HOME=${0%/*}
echo "LH1=$LENYA_HOME"
cd $LENYA_HOME
LENYA_HOME=`pwd -P`
echo "LH2=$LENYA_HOME"

Using people.apache.org:
/x1$ home/solprovider/test.sh
PWD= /x1
LH1=home/solprovider
LH2=/x1/home/solprovider

In English,
1. Get the path used to reach the current executable (LH1).
2. Change directory using the result of #1.  This is relative to the
current directory.  The current directory (PWD) is the directory from
which the command is called.
3. Get the absolute current path (LH2).  This removes dots and symbolic links.

This code works on every *nix except SunOS.  By default, SunOS uses the original
1977 shell, which did not have good string manipulation.  sh and awk
were the two required programs for Unix.    In 1977, string manipulation
required using awk.

I am ready to rewrite this to use awk to work on SunOS.  I am waiting
for access to zones so I can test the code.  I dislike guessing what
might work and submitting code hoping not to break anything.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to