diff options
Diffstat (limited to 'bin/sbang')
-rwxr-xr-x | bin/sbang | 23 |
1 files changed, 16 insertions, 7 deletions
@@ -1,14 +1,14 @@ #!/bin/bash ############################################################################## -# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. +# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-647188 # -# For details, see https://github.com/llnl/spack -# Please also see the LICENSE file for our notice and the LGPL. +# For details, see https://github.com/spack/spack +# Please also see the NOTICE and LICENSE files for our notice and the LGPL. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License (as @@ -104,18 +104,27 @@ lines=0 while read line && ((lines < 2)) ; do if [[ "$line" = '#!'* ]]; then interpreter="${line#\#!}" + elif [[ "$line" = '//!'*node* ]]; then + interpreter="${line#//!}" elif [[ "$line" = '--!'*lua* ]]; then interpreter="${line#--!}" fi lines=$((lines+1)) done < "$script" +# this is ineeded for scripts with sbang parameter +# like ones in intltool +# #!/<spack-long-path>/perl -w +# this is the interpreter line with all the parameters as a vector +interpreter_v=(${interpreter}) +# this is the single interpreter path +interpreter_f="${interpreter_v[0]}" # Invoke any interpreter found, or raise an error if none was found. -if [[ -n "$interpreter" ]]; then - if [[ "${interpreter##*/}" = "perl" ]]; then - exec $interpreter -x "$@" +if [[ -n "$interpreter_f" ]]; then + if [[ "${interpreter_f##*/}" = "perl" ]]; then + exec $interpreter_v -x "$@" else - exec $interpreter "$@" + exec $interpreter_v "$@" fi else echo "error: sbang found no interpreter in $script" |