On Sun, 2002-12-01 at 20:30, Rob Lahaye wrote: > Darren Freeman wrote: > > On Sun, 2002-12-01 at 16:18, Rob Lahaye wrote: > >>Darren, have a look at v0.3b :) > >>Prettyfied it a bit; functionality is same. > > > > Yes, but still much prettier. > > > > One functionality change is that it now doesn't check for lyx in the > > same directory as $0 which is what I was doing. Because I would aim for > > the script to live next to the lyx executable in the long run, that's a > > good place to look. Could add `dirname $0`/lyx to the "for i in ..." > > Isn't `dirname $0`/lyx same as ./lyx ?
I'd have to actually try it, but if the shell script is located in the lyx directory but the user is currently elsewhere, then I expect ./lyx to be looking where the user is, not where the script is. Unless sh changes directory automatically to where the script is, but my experience so far was that ./lyx-trace = where I am now, so ./lyx is also referring to where I am now. Whereas $0 is the full path to the script being run so it can be used to find files in the same dir as the script. You don't need to search ./lyx and ./src/lyx if you know that the script is definitely in src/lyx already (or in my case, linked from there). Play with it, I think I'm right =) > The for loop assumes ./lyx and ./src/lyx, which means searching > in `dirname $0`/lyx and `dirname $0`/src/lyx. My approach is shorter > and easier to read....unless I'm wrong at this point, but I don't > think so. Well that's if I did a cd to the dir where the script is, if I'm right. Otherwise it's *my* current directory. > I've also added "src/lyx", because that's where you expect the > executable to be when you are in the build directory. You do seem to assume that I cd to the lyd directory tree before running the script. But the way I've been using it, I cd to where my documents are before running lyxdbg. > Cheers, > Rob. Have fun, Darren