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

Re: executable scripts in debian/



OoO  Pendant le  repas  du vendredi  24  octobre 2008,  vers 19:10,  Kel
Modderman <kel@otaku42.de> disait :

> I'd choose the latter approach, so that any options given to the interpreter
> in the shebang line are honoured.

I react about "options". When using shebang, we can only pass one option.

#!/bin/sh a b c
-> /bin/sh: Can't open a b c

/bin/sh a b c
-> /bin/sh: Can't open a

I suppose  this is because  the kernel does  not want to  do shell-style
parsing of arguments.  Therefore, it is better to  not use this feature,
except for /usr/bin/env. For example, you could have this:

#!/usr/bin/perl -s

Suppose that someone wants to change  this to use perl in PATH. He would
try:

#!/usr/bin/env perl -s

And this won't work. Another example :

#!/bin/sh -e

Someone wants to debug, he would surely tries this:

#!/bin/sh -e -x

Therefore, to avoid confusion, it would be better to use:

#!/bin/sh
set -e
-- 
BOFH excuse #113:
Root nameservers are out of sync

Attachment: pgpmR8gA7d0Sd.pgp
Description: PGP signature


Reply to: