lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] [lmi-commits] odd/multiarch 768d4fc 4/7: Impede executing a sc


From: Greg Chicares
Subject: Re: [lmi] [lmi-commits] odd/multiarch 768d4fc 4/7: Impede executing a script that should instead be sourced
Date: Fri, 26 Apr 2019 00:04:17 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

On 2019-04-25 22:13, Vadim Zeitlin wrote:
> On Thu, 25 Apr 2019 17:54:22 -0400 (EDT) Greg Chicares <address@hidden> wrote:
[...]
> GC> +++ b/set_arch.sh
> GC> @@ -1,4 +1,4 @@
> GC> -#!/bin/sh
> GC> +#!/bin/sh this-script-must-be-sourced-not-run
> 
>  This is an interesting hack, but why do we need a hack at all here?
> Wouldn't it be better to just remove the shebang line completely and, for
> good measure, make the file non-executable?

I considered those ideas and others presented here:
  
https://unix.stackexchange.com/questions/424492/how-to-define-a-shell-script-to-be-sourced-not-run/424498
and preferred Ingo Karkat's answer because it's minimal and unobtrusive.
I thought of twiddling the executable bit in addition, but that seemed
unnecessary--and a script with no shebang may be difficult for tools to
recognize as a script.

Ingo's "Feb 16 '18 at 9:25" comment mentions vim detection as well. Do
you happen to know the magic setting to make vim detect 'GNUmakefile'
as a makefile? I just noticed that it's formatted differently than
'*.make' files here. (All my vim and zsh settings are in lmi git, in
the gwc/ subdirectory.)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]