Re: bash scripts: how to determine directory of 'source'd file



On Tue, Jan 31, 2006 at 02:26:27PM +0000, michael wrote:
> Presuming I have a file setEnvVars.sh that I wish to source,
> . path/setEnvVars.sh
> How do I, within the script, determine the actual directory within which
> the setEnvVars.sh file sits? The sourcing seems to disallow me access to
> $0 etc
>
> thanks, M

If I understand your question correctly, the '$_' variable should do
the trick.

--j

Attachment:signature.asc
Description: Digital signature



Relevant Pages

  • Re: bash scripts: how to determine directory of sourced file
    ... michael wrote: ... How do I, within the script, determine the actual directory within which ... The sourcing seems to disallow me access to ...
    (Debian-User)
  • Re: a variable CD in a CSH script
    ... and make sure the script doesn't have execute permission (so you don't ... > I tried sourcing it, and running it normally (which obviously wouldn't ... > my alias is 'alias utgo "source utgo.scpt"' ... and do not have the option to upgrade to tcsh. ...
    (comp.unix.shell)
  • Re: Seamonkey -- has anybody successfully installed it?
    ... I'm not sure if sourcing is the best idea in this case, ... with a bunch of settings in your shell you realy don't want to have. ... you may be using a different shell from the one the script ...
    (Ubuntu)
  • Re: How to export environment variable to parent?
    ... sourcing a script and running it. ... Autodumbdacticism. ... Charlie Zender, my_surname@uci.edu, 824-2987, Department of ...
    (comp.unix.shell)
  • Re: Software restriction policies
    ... and start to script my own polices. ... Now what I want to do is that forbidding all exe files running under ... we can't disallow root directory? ...
    (microsoft.public.security)