Skip to content

change shebang lines for relocatable perl

License

Notifications You must be signed in to change notification settings

aadnehovda/change-shebang

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

NAME

App::ChangeShebang - change shebang lines for relocatable perl

SYNOPSIS

> change-shebang /path/to/bin/script.pl

> head -3 /path/to/bin/script.pl
#!/bin/sh
exec "$(dirname "$0")"/perl -x "$0" "$@"
#!perl

DESCRIPTION

change-shebang changes shebang lines from

#!/path/to/bin/perl

to

#!/bin/sh
exec "$(dirname "$0")"/perl -x "$0" "$@"
#!perl

Why do we need this?

Let's say you build perl with relocatable enabled (-Duserelocatableinc). Then the shebang lines of executable scripts point at the installation time perl binary path.

So if you move your perl directory to other places, the shebang lines of executable scripts point at a wrong perl binary and we cannot execute scripts. Oops!

A solution of that problem is to replace shebang lines by

#!/bin/sh
exec "$(dirname "$0")"/perl -x "$0" "$@"
#!perl

which means that scripts will be executed by the perl located in the same directory.

SEE ALSO

AUTHOR

Shoichi Kaji [email protected]

COPYRIGHT AND LICENSE

Copyright 2018 Shoichi Kaji [email protected]

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

About

change shebang lines for relocatable perl

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Perl 100.0%