remove #! from beginning of loaded files to support use in shell scripts

This commit is contained in:
Pekka Laiho 2020-12-13 15:34:03 +07:00
parent 2b8be79c0e
commit 7e146d8a9d

View File

@ -322,6 +322,11 @@ class Evaller
$input = @file_get_contents($targetFile); $input = @file_get_contents($targetFile);
// Remove #! from the beginning that is used by shell scripts
if (extension_loaded('pcre')) {
$input = preg_replace('/^#![^\n\r]*[\n\r]+/', '', $input, 1);
}
// Wrap input in a do to process multiple expressions // Wrap input in a do to process multiple expressions
$input = "(do $input)"; $input = "(do $input)";