ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Mojca Miklavec <mojca.miklavec.lists@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Dash equivalent of $BASH_SOURCE (for setuptex)
Date: Wed, 21 Nov 2012 12:56:54 +0100	[thread overview]
Message-ID: <CALBOmsa7YfUjVDU4v=yJ+mo4K9yhZzLy0ydjbukv30J4hTmncA@mail.gmail.com> (raw)

Hi everyone,

Hans wrote me the following, but I'm unable to figure it out myself.
The script "setuptex" (which is in fact not urgently needed as one can
just as well export the right path, but it comes in handy) can be used
in two ways:
    (a) . /path/to/context/tex/setuptex
    (b) . /path/to/context/tex/setuptex /path/to/context/tex
The first approach only works if the shell interpreting setuptex knows
where the sourced script is located.

Currently the script uses the following code and works in Bash, KSH
(and maybe some other shells as well, but I'm not sure which ones).

if [ z"$BASH_SOURCE" != z ]; then
  SCRIPTPATH="$BASH_SOURCE"
elif [ z"$KSH_VERSION" != z ]; then
  SCRIPTPATH="${.sh.file}"
else
  SCRIPTPATH="$0"
fi

Hans had problems with Dash, however, I have no clue how to enable (a)
in Dash. The (b) approach always works though, so in the worst case
the answer to Hans would be "provide the path to your tex root, or
write your own script with hardcoded path ;)", but if anyone has any
clue if finding path to the executed script is possible in Dash or in
any other POSIX-compatible way, please let me know.

Mojca

On Mon, Nov 19, 2012 at 10:31 AM, Hans Hagen wrote:
> Hi Mojca,
>
> One of the things you need to look into is the first-setup and setup tex
> scripts (just look at the dash issues thread) .. i have the impression that
> the setuptex script doesn't find its root (own) under dash because it has
> different $0 handling (dash is the debian variant of bash, so we're talking
> of debian installations)
>
> Hans
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


             reply	other threads:[~2012-11-21 11:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-21 11:56 Mojca Miklavec [this message]
2012-11-21 17:35 ` Alan BRASLAU
2012-11-21 18:45   ` Mojca Miklavec
2012-11-21 19:28     ` Peter Münster
2012-11-21 21:05       ` Mojca Miklavec
2012-11-22  9:18       ` Hans Hagen
2012-11-22  9:21         ` Taco Hoekwater
2012-11-22  9:39           ` Alan BRASLAU
2012-11-21 18:12 ` Peter Münster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALBOmsa7YfUjVDU4v=yJ+mo4K9yhZzLy0ydjbukv30J4hTmncA@mail.gmail.com' \
    --to=mojca.miklavec.lists@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).