Skip to content

erantapaa/relexec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

relexec

relexec is a simple utility to execute an interpreter relative to where the script is located.

Usage

Compile relexec.c and install in a well-known place, e.g. /bin or /usr/bin.

In your scripts, use the following she-bang line:

#!/usr/bin/relexec {relative-path-to-interpreter}

Example

Assume the following directory layout:

$TOP/
  +- bin/
       +- perl
       +- script.pl
  +- dir1/
       +- other.pl

Both scripts, script.pl and other.pl, are perl scripts which should be executed by the perl interpreter at $TOP/bin/perl.

The she-bang line for script.pl:

#!/usr/bin/relexec perl

The she-bang line for other.pl:

#/usr/bin/relexec ../bin/perl

This makes the scripts location independent.

About

exec an interperter relative to the script's location

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published