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

Re: how execute a script

Hash: SHA1

On Fri, Nov 13, 2015 at 09:11:34AM -0600, David Wright wrote:
> On Fri 13 Nov 2015 at 14:43:39 (+0100), tomas@tuxteam.de wrote:
> > (as an aside: it's bad custom inherited from DOS to name shell scripts
> > with an .sh ending. No ending is the right thing here).
> So these were all DOS scripts once, were they?
> -rwxr-xr-x 1 root root 1248 Apr 21  2014 /etc/init.d/bootmisc.sh*
> -rwxr-xr-x 1 root root 3807 Apr 21  2014 /etc/init.d/checkfs.sh*


Very smart. I didn't say the scripts are inherited from DOS. That bad
habit is, definitely.

> I name my scripts in ~/bin with an extension corresponding to their
> contents: .pl .py .sh etc. Where I'm working on alternative versions,
> I might have more than one language. Extensionless filenames are
> either links or binaries. What's bad about this? Or is it just
> snobbery: Look, we don't need extensions.

No. If you call your scripts from other places, and -- say -- change
the implementation from shell to ruby: do you have to run around and
fix all the call sites? Have fun.

The one case where an "extension" (as you call it: DOS, see?) might
make sense (I'd say a hint in the filename) is when your script isn't
an executable in itself but a collection of functions you *source*
from another shell: this so-called "shell library" has to be shell
code (i.e. you can't change implementation).

And snobbery? Pthttht.

- -- t
Version: GnuPG v1.4.12 (GNU/Linux)


Reply to: