Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

If mathematically you end up with the wrong answer, try multiplying by the page number.


computers / comp.os.linux.misc / Should script files have a .sh suffix?

SubjectAuthor
* Should script files have a .sh suffix?Charlie Gibbs
+* Re: Should script files have a .sh suffix?Richard Kettlewell
|`- Re: Should script files have a .sh suffix?Robert Heller
+* Re: Should script files have a .sh suffix?Computer Nerd Kev
|`* Re: Should script files have a .sh suffix?David W. Hodgins
| `* Re: Should script files have a .sh suffix?Computer Nerd Kev
|  `- Re: Should script files have a .sh suffix?David W. Hodgins
+- Re: Should script files have a .sh suffix?John McCue
+- Re: Should script files have a .sh suffix?Marco Moock
+* Re: Should script files have a .sh suffix?Giovanni
|`- Re: Should script files have a .sh suffix?David W. Hodgins
+- Re: Should script files have a .sh suffix?The Natural Philosopher
+- Re: Should script files have a .sh suffix?Blue-Maned_Hawk
+- Re: Should script files have a .sh suffix?Woozy Song
`* Re: Should script files have a .sh suffix?Carlos E. R.
 `* Re: Should script files have a .sh suffix?Charlie Gibbs
  `- Re: Should script files have a .sh suffix?David W. Hodgins

1
Should script files have a .sh suffix?

<scrKM.1052734$SuUf.593562@fx14.iad>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=11861&group=comp.os.linux.misc#11861

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx14.iad.POSTED!not-for-mail
Newsgroups: comp.os.linux.misc
From: cgi...@kltpzyxm.invalid (Charlie Gibbs)
Subject: Should script files have a .sh suffix?
User-Agent: slrn/1.0.3 (Linux)
Lines: 20
Message-ID: <scrKM.1052734$SuUf.593562@fx14.iad>
X-Complaints-To: https://www.astraweb.com/aup
NNTP-Posting-Date: Thu, 07 Sep 2023 21:24:40 UTC
Date: Thu, 07 Sep 2023 21:24:40 GMT
X-Received-Bytes: 1497
 by: Charlie Gibbs - Thu, 7 Sep 2023 21:24 UTC

We have a system consisting of dozens of executables and a number of
scripts, some of which are run automatically. In the Windows version,
the executables have a .exe suffix and scripts (a.k.a. batch files)
have a .bat suffix. So far I've written the Linux version so that
neither executables nor scripts have a suffix. However, our support
people want to be able to easily grab copies of all scripts (e.g. for
backups). If I were to modify the system so that all scripts have a
..sh suffix, that would satisfy this wish.

I've searched the web in various places (including stackoverflow)
and found lots of conflicting information over whether a .sh suffix
is desirable. So I thought I'd throw out the question here.

Just when you thought the Ford vs. Chevy debate had died down...

--
/~\ Charlie Gibbs | They offer a huge range of
\ / <cgibbs@kltpzyxm.invalid> | world-class vulnerabilities
X I'm really at ac.dekanfrus | that only Microsoft can provide.
/ \ if you read it the right way. | -- druck <news@druck.org.uk>

Re: Should script files have a .sh suffix?

<wwvh6o5zn77.fsf@LkoBDZeT.terraraq.uk>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=11862&group=comp.os.linux.misc#11862

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!news.nntp4.net!nntp.terraraq.uk!.POSTED.tunnel.sfere.anjou.terraraq.org.uk!not-for-mail
From: inva...@invalid.invalid (Richard Kettlewell)
Newsgroups: comp.os.linux.misc
Subject: Re: Should script files have a .sh suffix?
Date: Thu, 07 Sep 2023 22:29:48 +0100
Organization: terraraq NNTP server
Message-ID: <wwvh6o5zn77.fsf@LkoBDZeT.terraraq.uk>
References: <scrKM.1052734$SuUf.593562@fx14.iad>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: innmantic.terraraq.uk; posting-host="tunnel.sfere.anjou.terraraq.org.uk:172.17.207.6";
logging-data="34817"; mail-complaints-to="usenet@innmantic.terraraq.uk"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:uo0tANUElckKK2aFgAhgO32vNcw=
X-Face: h[Hh-7npe<<b4/eW[]sat,I3O`t8A`(ej.H!F4\8|;ih)`7{@:A~/j1}gTt4e7-n*F?.Rl^
F<\{jehn7.KrO{!7=:(@J~]<.[{>v9!1<qZY,{EJxg6?Er4Y7Ng2\Ft>Z&W?r\c.!4DXH5PWpga"ha
+r0NzP?vnz:e/knOY)PI-
X-Boydie: NO
 by: Richard Kettlewell - Thu, 7 Sep 2023 21:29 UTC

Charlie Gibbs <cgibbs@kltpzyxm.invalid> writes:
> We have a system consisting of dozens of executables and a number of
> scripts, some of which are run automatically. In the Windows version,
> the executables have a .exe suffix and scripts (a.k.a. batch files)
> have a .bat suffix. So far I've written the Linux version so that
> neither executables nor scripts have a suffix. However, our support
> people want to be able to easily grab copies of all scripts (e.g. for
> backups). If I were to modify the system so that all scripts have a
> .sh suffix, that would satisfy this wish.
>
> I've searched the web in various places (including stackoverflow)
> and found lots of conflicting information over whether a .sh suffix
> is desirable. So I thought I'd throw out the question here.

The OS doesn’t care. Do whatever’s most convenient for the humans who
will actually be using the system.

--
https://www.greenend.org.uk/rjk/

Re: Should script files have a .sh suffix?

<64fa51b4@news.ausics.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=11863&group=comp.os.linux.misc#11863

  copy link   Newsgroups: comp.os.linux.misc
Message-ID: <64fa51b4@news.ausics.net>
From: not...@telling.you.invalid (Computer Nerd Kev)
Subject: Re: Should script files have a .sh suffix?
Newsgroups: comp.os.linux.misc
References: <scrKM.1052734$SuUf.593562@fx14.iad>
User-Agent: tin/2.0.1-20111224 ("Achenvoir") (UNIX) (Linux/2.4.31 (i586))
NNTP-Posting-Host: news.ausics.net
Date: 8 Sep 2023 08:41:57 +1000
Organization: Ausics - https://www.ausics.net
Lines: 29
X-Complaints: abuse@ausics.net
Path: i2pn2.org!i2pn.org!news.bbs.nz!news.ausics.net!not-for-mail
 by: Computer Nerd Kev - Thu, 7 Sep 2023 22:41 UTC

Charlie Gibbs <cgibbs@kltpzyxm.invalid> wrote:
> We have a system consisting of dozens of executables and a number of
> scripts, some of which are run automatically. In the Windows version,
> the executables have a .exe suffix and scripts (a.k.a. batch files)
> have a .bat suffix. So far I've written the Linux version so that
> neither executables nor scripts have a suffix. However, our support
> people want to be able to easily grab copies of all scripts (e.g. for
> backups). If I were to modify the system so that all scripts have a
> .sh suffix, that would satisfy this wish.
>
> I've searched the web in various places (including stackoverflow)
> and found lots of conflicting information over whether a .sh suffix
> is desirable. So I thought I'd throw out the question here.

I've seen arguments against it, but my preference is to use .sh for
easier identification, however if a script is run from the
command-line I prefer to make a symlink to it without the .sh
extension. That avoids adding length to commands, and also solves
the problem of what to do if you want to rewrite it in another
language later but lots of scripts/people call it by the existing
name.

File managers also know what to open a .sh file with, short of
running something like "file" over everything (which I guess some
probably do).

--
__ __
#_ < |\| |< _#

Re: Should script files have a .sh suffix?

<QN-dnQdmddTfyGf5nZ2dnZfqn_ednZ2d@giganews.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=11864&group=comp.os.linux.misc#11864

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-1.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Thu, 07 Sep 2023 22:57:06 +0000
MIME-Version: 1.0
From: hel...@deepsoft.com (Robert Heller)
Organization: Deepwoods Software
X-Newsreader: TkNews 3.0 (1.2.15)
Subject: Re: Should script files have a .sh suffix?
In-Reply-To: <wwvh6o5zn77.fsf@LkoBDZeT.terraraq.uk>
References: <scrKM.1052734$SuUf.593562@fx14.iad>
<wwvh6o5zn77.fsf@LkoBDZeT.terraraq.uk>
Newsgroups: comp.os.linux.misc
Content-Type: text/plain;
charset="us-ascii"
Originator: heller@sharky4.deepsoft.com
Message-ID: <QN-dnQdmddTfyGf5nZ2dnZfqn_ednZ2d@giganews.com>
Date: Thu, 07 Sep 2023 22:57:06 +0000
Lines: 31
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-1agXyTIF4ughGEg+892tccRx3j0JcwaCdk9uAvcSI17F7BISOMvXUAtTpun8pKWKwNNEcTLrjb8PUWe!MXiwJMVnw7+ikZ/mgAS0dcaqfFX84GLiLaRteuEjJ1md+WfMufELiLfR2loloowR5fgdQ+RS0/6i!MaY=
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
 by: Robert Heller - Thu, 7 Sep 2023 22:57 UTC

At Thu, 07 Sep 2023 22:29:48 +0100 Richard Kettlewell <invalid@invalid.invalid> wrote:

>
> Charlie Gibbs <cgibbs@kltpzyxm.invalid> writes:
> > We have a system consisting of dozens of executables and a number of
> > scripts, some of which are run automatically. In the Windows version,
> > the executables have a .exe suffix and scripts (a.k.a. batch files)
> > have a .bat suffix. So far I've written the Linux version so that
> > neither executables nor scripts have a suffix. However, our support
> > people want to be able to easily grab copies of all scripts (e.g. for
> > backups). If I were to modify the system so that all scripts have a
> > .sh suffix, that would satisfy this wish.
> >
> > I've searched the web in various places (including stackoverflow)
> > and found lots of conflicting information over whether a .sh suffix
> > is desirable. So I thought I'd throw out the question here.
>
> The OS doesn't care. Do whatever's most convenient for the humans who
> will actually be using the system.
>

Although Linux and UNIX binary executables (eg "a.out" files), generally have
no extension, I have used packages where such files are given an extension as
a convension.

--
Robert Heller -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
heller@deepsoft.com -- Webhosting Services

Re: Should script files have a .sh suffix?

<uddmg3$35g4h$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=11865&group=comp.os.linux.misc#11865

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jmc...@magnetar.jmcunx.com (John McCue)
Newsgroups: comp.os.linux.misc
Subject: Re: Should script files have a .sh suffix?
Date: Thu, 7 Sep 2023 23:31:15 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <uddmg3$35g4h$1@dont-email.me>
References: <scrKM.1052734$SuUf.593562@fx14.iad>
Reply-To: jmclnx@SPAMisBADgmail.com
Injection-Date: Thu, 7 Sep 2023 23:31:15 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6f914cbfbd2eb1e16c594fdca084513c";
logging-data="3326097"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19QgHfb8Yc0B4Kx0bUi9Hpl"
User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.118 (x86_64))
Cancel-Lock: sha1:0j8MzVWvyA+6W/6YGSVp4vSdIWg=
X-OS-Version: Slackware 15.0 x86_64
 by: John McCue - Thu, 7 Sep 2023 23:31 UTC

Charlie Gibbs <cgibbs@kltpzyxm.invalid> wrote:
> We have a system consisting of dozens of executables and a number of
> scripts, some of which are run automatically. In the Windows version,
> the executables have a .exe suffix and scripts (a.k.a. batch files)
> have a .bat suffix. So far I've written the Linux version so that
> neither executables nor scripts have a suffix. However, our support
> people want to be able to easily grab copies of all scripts (e.g. for
> backups). If I were to modify the system so that all scripts have a
> .sh suffix, that would satisfy this wish.

If this is a production system, I would say *no*. Some
objects may fail. You should teach them to use file(1).

If you must do something, I would symbolic the scripts to
whatever.sh to make them happy :)

<snip>
--
[t]csh(1) - "An elegant shell, for a more... civilized age."
- Paraphrasing Star Wars

Re: Should script files have a .sh suffix?

<op.2axfgalva3w0dxdave@hodgins.homeip.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=11866&group=comp.os.linux.misc#11866

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dwhodg...@nomail.afraid.org (David W. Hodgins)
Newsgroups: comp.os.linux.misc
Subject: Re: Should script files have a .sh suffix?
Date: Thu, 07 Sep 2023 20:25:12 -0400
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <op.2axfgalva3w0dxdave@hodgins.homeip.net>
References: <scrKM.1052734$SuUf.593562@fx14.iad> <64fa51b4@news.ausics.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="b8212571dff65bccb85ae3ae5fdd9390";
logging-data="3339699"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/186/QbUqzpgHzBWai+4fgws4h+t89O8U="
User-Agent: Opera Mail/12.16 (Linux)
Cancel-Lock: sha1:S+rHH+TzK6Fol5LTEA+/qVhBbmA=
 by: David W. Hodgins - Fri, 8 Sep 2023 00:25 UTC

On Thu, 07 Sep 2023 18:41:57 -0400, Computer Nerd Kev <not@telling.you.invalid> wrote:
> File managers also know what to open a .sh file with, short of
> running something like "file" over everything (which I guess some
> probably do).

A file manager should not be choosing how to execute a script, and I don't know
of any that do.

How anything gets executed in linux is controlled by the kernel when execv is
called. If it starts with .ELF then it's a binary elf executable, if it starts
with #! then it's a script, that is to be interpreted by the executable that
is in the text after #!. If it's a text file without a shebang then it uses
the interpreter listed for that user in /etc/passwd.

There are places where the extension does matter. In the case of the script
/etc/profile, the executable files in /etc/profile.d/*.sh are executed when
logging in using bash. Those that end in .csh are executed when logging in with
csh, etc.

For scripts that the user runs though, the extension does not matter to the system
though it may or may not matter to the user.

Regards, Dave Hodgins

Re: Should script files have a .sh suffix?

<64fa7ecd@news.ausics.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=11867&group=comp.os.linux.misc#11867

  copy link   Newsgroups: comp.os.linux.misc
Message-ID: <64fa7ecd@news.ausics.net>
From: not...@telling.you.invalid (Computer Nerd Kev)
Subject: Re: Should script files have a .sh suffix?
Newsgroups: comp.os.linux.misc
References: <scrKM.1052734$SuUf.593562@fx14.iad> <64fa51b4@news.ausics.net> <op.2axfgalva3w0dxdave@hodgins.homeip.net>
User-Agent: tin/2.0.1-20111224 ("Achenvoir") (UNIX) (Linux/2.4.31 (i686))
NNTP-Posting-Host: news.ausics.net
Date: 8 Sep 2023 11:54:22 +1000
Organization: Ausics - https://www.ausics.net
Lines: 16
X-Complaints: abuse@ausics.net
Path: i2pn2.org!i2pn.org!news.bbs.nz!news.ausics.net!not-for-mail
 by: Computer Nerd Kev - Fri, 8 Sep 2023 01:54 UTC

David W. Hodgins <dwhodgins@nomail.afraid.org> wrote:
> On Thu, 07 Sep 2023 18:41:57 -0400, Computer Nerd Kev <not@telling.you.invalid> wrote:
>> File managers also know what to open a .sh file with, short of
>> running something like "file" over everything (which I guess some
>> probably do).
>
> A file manager should not be choosing how to execute a script, and I don't know
> of any that do.

By "open" I meant "view/edit". I wouldn't run/execute a script file
from a file manager interface out of preference. If a file manager
called that "opening", I'd be immediately confused.

--
__ __
#_ < |\| |< _#

Re: Should script files have a .sh suffix?

<op.2axnbmy4a3w0dxdave@hodgins.homeip.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=11868&group=comp.os.linux.misc#11868

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dwhodg...@nomail.afraid.org (David W. Hodgins)
Newsgroups: comp.os.linux.misc
Subject: Re: Should script files have a .sh suffix?
Date: Thu, 07 Sep 2023 23:15:12 -0400
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <op.2axnbmy4a3w0dxdave@hodgins.homeip.net>
References: <scrKM.1052734$SuUf.593562@fx14.iad> <64fa51b4@news.ausics.net>
<op.2axfgalva3w0dxdave@hodgins.homeip.net> <64fa7ecd@news.ausics.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="b8212571dff65bccb85ae3ae5fdd9390";
logging-data="3500251"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+mVHVCjjX3J03q44+IBIPrlvn0Wy4+M2g="
User-Agent: Opera Mail/12.16 (Linux)
Cancel-Lock: sha1:qy5w0Dg+Q7zgQjK5nVa2QGX9ezg=
 by: David W. Hodgins - Fri, 8 Sep 2023 03:15 UTC

On Thu, 07 Sep 2023 21:54:22 -0400, Computer Nerd Kev <not@telling.you.invalid> wrote:
> By "open" I meant "view/edit". I wouldn't run/execute a script file
> from a file manager interface out of preference. If a file manager
> called that "opening", I'd be immediately confused.

Ok. Gotcha. Some file managers allow viewing, editing, or executing files.

Regards, Dave Hodgins

Re: Should script files have a .sh suffix?

<udeg3l$3c257$4@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=11869&group=comp.os.linux.misc#11869

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mm+use...@dorfdsl.de (Marco Moock)
Newsgroups: comp.os.linux.misc
Subject: Re: Should script files have a .sh suffix?
Date: Fri, 8 Sep 2023 08:48:21 +0200
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <udeg3l$3c257$4@dont-email.me>
References: <scrKM.1052734$SuUf.593562@fx14.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 8 Sep 2023 06:48:21 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="eea1413321254ccc75390a72fcd7eaeb";
logging-data="3541159"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18WjuJJLtHwosspFVcq06cg"
Cancel-Lock: sha1:PiEkxnJJzGgAjDkSrSUjUQZSTPk=
 by: Marco Moock - Fri, 8 Sep 2023 06:48 UTC

Am 07.09.2023 schrieb Charlie Gibbs <cgibbs@kltpzyxm.invalid>:

> We have a system consisting of dozens of executables and a number of
> scripts, some of which are run automatically. In the Windows version,
> the executables have a .exe suffix and scripts (a.k.a. batch files)
> have a .bat suffix. So far I've written the Linux version so that
> neither executables nor scripts have a suffix. However, our support
> people want to be able to easily grab copies of all scripts (e.g. for
> backups). If I were to modify the system so that all scripts have a
> .sh suffix, that would satisfy this wish.

The file system itself doesn't care and bash also doesn't care.
Relevant in shell scrips is the interpreter, the line that starts with
#. The script also needs to be executable to directly run it. If not,
you have to run "bash script(.sh)".

I recommend using the file extensions because it makes it easy to
identify the content without opening.

Re: Should script files have a .sh suffix?

<udegli$4lp$1@milena.home.net.it>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=11870&group=comp.os.linux.misc#11870

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: lsod...@home.net.it (Giovanni)
Newsgroups: comp.os.linux.misc
Subject: Re: Should script files have a .sh suffix?
Date: Fri, 8 Sep 2023 08:57:54 +0200
Organization: G. Falzoni Home Network
Lines: 20
Message-ID: <udegli$4lp$1@milena.home.net.it>
References: <scrKM.1052734$SuUf.593562@fx14.iad>
Reply-To: gfalzoni@inwind.it
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="00b1986b2deb8259d2153aaf946ed468";
logging-data="3547624"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/uorN4tYSGwJ6OtVC1LrMG/mnPoETbqnlBY6Z8xDuYUg=="
Cancel-Lock: sha1:Gg+gOAsK+Y4hcHzHujytaQF9WUo=
 by: Giovanni - Fri, 8 Sep 2023 06:57 UTC

On 9/7/23 23:24, Charlie Gibbs wrote:
> We have a system consisting of dozens of executables and a number of
> scripts, some of which are run automatically. In the Windows version,
> the executables have a .exe suffix and scripts (a.k.a. batch files)
> have a .bat suffix. So far I've written the Linux version so that
> neither executables nor scripts have a suffix. However, our support
> people want to be able to easily grab copies of all scripts (e.g. for
> backups). If I were to modify the system so that all scripts have a
> .sh suffix, that would satisfy this wish.

In the Linux/Unix world no suffix is required but executables are
identified from their file mode being executable. Windows has no such
file mode and uses the extension to detect a file as executable.

Ciao
Giovanni
--
A computer is like an air conditioner,
it stops working when you open Windows.
< https://giovanni.homelinux.net/ >

Re: Should script files have a .sh suffix?

<udehad$3capo$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=11871&group=comp.os.linux.misc#11871

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tnp...@invalid.invalid (The Natural Philosopher)
Newsgroups: comp.os.linux.misc
Subject: Re: Should script files have a .sh suffix?
Date: Fri, 8 Sep 2023 08:09:00 +0100
Organization: A little, after lunch
Lines: 37
Message-ID: <udehad$3capo$1@dont-email.me>
References: <scrKM.1052734$SuUf.593562@fx14.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 8 Sep 2023 07:09:01 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f14feacbdca86886258808a7c91298ed";
logging-data="3550008"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+0HU3ZXK3WOiWj9j6lBXeTudOk/QcBSZ0="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.15.0
Cancel-Lock: sha1:f2l//KFBetKp8m7MfeJRiyEf5Qc=
Content-Language: en-GB
In-Reply-To: <scrKM.1052734$SuUf.593562@fx14.iad>
 by: The Natural Philosop - Fri, 8 Sep 2023 07:09 UTC

On 07/09/2023 22:24, Charlie Gibbs wrote:
> We have a system consisting of dozens of executables and a number of
> scripts, some of which are run automatically. In the Windows version,
> the executables have a .exe suffix and scripts (a.k.a. batch files)
> have a .bat suffix. So far I've written the Linux version so that
> neither executables nor scripts have a suffix. However, our support
> people want to be able to easily grab copies of all scripts (e.g. for
> backups). If I were to modify the system so that all scripts have a
> .sh suffix, that would satisfy this wish.
>
> I've searched the web in various places (including stackoverflow)
> and found lots of conflicting information over whether a .sh suffix
> is desirable. So I thought I'd throw out the question here.
>
> Just when you thought the Ford vs. Chevy debate had died down...
>
I myself pop a .sh on the back simply to identify them as things I have
written. They also have their own directory. /usr/local/scripts.

But as with all things *nix, nothing is mandatory. Their name is
entirely down to what standards and conventions you choose to set.

--
“it should be clear by now to everyone that activist environmentalism
(or environmental activism) is becoming a general ideology about humans,
about their freedom, about the relationship between the individual and
the state, and about the manipulation of people under the guise of a
'noble' idea. It is not an honest pursuit of 'sustainable development,'
a matter of elementary environmental protection, or a search for
rational mechanisms designed to achieve a healthy environment. Yet
things do occur that make you shake your head and remind yourself that
you live neither in Joseph Stalin’s Communist era, nor in the Orwellian
utopia of 1984.”

Vaclav Klaus

Re: Should script files have a .sh suffix?

<pan$c5e1d$a34ce20$55bd6be3$1b91d53c@invalid.invalid>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=11872&group=comp.os.linux.misc#11872

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!bluemanedhawk.eternal-september.org!.POSTED!not-for-mail
From: bluemane...@invalid.invalid (Blue-Maned_Hawk)
Newsgroups: comp.os.linux.misc
Subject: Re: Should script files have a .sh suffix?
Date: Fri, 8 Sep 2023 10:19:27 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <pan$c5e1d$a34ce20$55bd6be3$1b91d53c@invalid.invalid>
References: <scrKM.1052734$SuUf.593562@fx14.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 8 Sep 2023 10:19:27 -0000 (UTC)
Injection-Info: bluemanedhawk.eternal-september.org; posting-host="e6970823ddfce65238e644d1e8d484cf";
logging-data="3597094"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/TFgEBGeEPFESeHm2Ja6hnRfDFJlqw/kc="
User-Agent: Pan/0.154 (Izium; 517acf4)
Cancel-Lock: sha1:AGZQwb3j+npG7TgTFZnvv733Ohs=
X-Face: Llanfair­pwllgwyngyll­gogery­chwyrnÂ
­drobwll­llan
? ?­tysilio­gogo­goch
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACh0lEQVRYw71Z21bD
MAzzevbfkr4cHjrSXJyL044+MDa6WLEl2SkvkrZ1AbAvXO+bUGSCPYnsuIVGMpm
ZLnjX718GhAKNsp8lON2F9VrhELwIgJlBepkZjA78rVK+FkmNhEJK76UsJlz8+E
rJsjrpYouhLo/SC6qPHgakFOR8wV9+8rCfO/I/oVnmUZUp42/LW2XkLj9TCFNM9
jp5g2EmHZgpYZjCOkYU7sXVogRylJqpdggoFLG1g09Flah/7kErCxzR9HgXPYsq
0glb9cxjIz2Vsk9AmAoCSxECpD713joMKjQqLAtmMqJmXjdVvlMnMQCVITotJd1
z+fh1f1NNo+vuc1KnhWUmY7t03vydTud9BbXCtN3L2PL3bK7JCNG0GHzuZxafyB
fxevCxpm1vrwZltqw6SILCcdoCE6PGQC8wZWDA9Or7Qp5s3lAZezys0nDazs9S9
R0TjwEiksRxLkNPC1NMMWPs1bj0Ei0Yuo+JVtFLuzP1NRJ16qXWN8DhhtmS4PDg
O6mqRxs4bEJrYt087mSIow/1VzW2oFlMQuiuIy/KsUagvhdw6hSjJGlIavbLF8x
j3X47bccLcUSi0dkWh1nUZNhANT1tHKUXrNxNLbd9KPb9wDDVrKwmPQMOPQ1oy6
k5I1DwzDeRJd3jVIhDAUxq3ngzJG4CCkNXZxZVMcjefoK2J0gUY2S3rxz/RuTFx
2zHd9U+obimJXMG4edsk/2j5pTU5G1MmzbRLxkfq5EiT1GGsidvMGzi+1goGb2l
GCrN+nGnV8xj3q3JLRDVPL96vUc7Z4aJ3TN1mVqWAMJMfG+Jxh6TQqP+92iZkCU
xtglds1AB6r0aiSHKcnFck+p/c/0CbacFLQcajGcAAAAASUVORK5CYII=
 by: Blue-Maned_Hawk - Fri, 8 Sep 2023 10:19 UTC

On Thu, 07 Sep 2023 21:24:40 GMT, Charlie Gibbs wrote:

> We have a system consisting of dozens of executables and a number of
> scripts, some of which are run automatically. In the Windows version,
> the executables have a .exe suffix and scripts (a.k.a. batch files) have
> a .bat suffix. So far I've written the Linux version so that neither
> executables nor scripts have a suffix. However, our support people want
> to be able to easily grab copies of all scripts (e.g. for backups). If
> I were to modify the system so that all scripts have a .sh suffix, that
> would satisfy this wish.
>
> I've searched the web in various places (including stackoverflow)
> and found lots of conflicting information over whether a .sh suffix is
> desirable. So I thought I'd throw out the question here.
>
> Just when you thought the Ford vs. Chevy debate had died down...

It seems to me like your support people could just get the files based on
whether or not they have a shebang line or not—suffixing the files
with .sh would be redundant for identification.

--
Blue-Maned_Hawk│shortens to Hawk│/blu.mɛin.dʰak/│he/him/
his/himself/Mr. bluemanedhawk.github.io
The fact that 'shelled' means 'shell has been removed' and not 'shell has
been left on' is not intuitive.

Re: Should script files have a .sh suffix?

<udeuu7$3e7st$2@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=11873&group=comp.os.linux.misc#11873

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: suzyw...@outlook.com (Woozy Song)
Newsgroups: comp.os.linux.misc
Subject: Re: Should script files have a .sh suffix?
Date: Fri, 8 Sep 2023 19:01:27 +0800
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <udeuu7$3e7st$2@dont-email.me>
References: <scrKM.1052734$SuUf.593562@fx14.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 8 Sep 2023 11:01:28 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="0a52744a05cecf12ca569bf796cf6a45";
logging-data="3612573"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/fbPPHrREJ19KttnHGN9WcmTyh0u5IuNs="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.17
Cancel-Lock: sha1:aENjJC96qATegAEAlzH6cz2KYPw=
In-Reply-To: <scrKM.1052734$SuUf.593562@fx14.iad>
 by: Woozy Song - Fri, 8 Sep 2023 11:01 UTC

Charlie Gibbs wrote:
> We have a system consisting of dozens of executables and a number of
> scripts, some of which are run automatically. In the Windows version,
> the executables have a .exe suffix and scripts (a.k.a. batch files)
> have a .bat suffix. So far I've written the Linux version so that
> neither executables nor scripts have a suffix. However, our support
> people want to be able to easily grab copies of all scripts (e.g. for
> backups). If I were to modify the system so that all scripts have a
> .sh suffix, that would satisfy this wish.
>
> I've searched the web in various places (including stackoverflow)
> and found lots of conflicting information over whether a .sh suffix
> is desirable. So I thought I'd throw out the question here.
>
> Just when you thought the Ford vs. Chevy debate had died down...
>

I use an "agnostic" package written long ago. It has .sh scripts for
bash and .csh scripts for csh.

Re: Should script files have a .sh suffix?

<km0ngrFpjpdU1@mid.individual.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=11874&group=comp.os.linux.misc#11874

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: robin_li...@es.invalid (Carlos E. R.)
Newsgroups: comp.os.linux.misc
Subject: Re: Should script files have a .sh suffix?
Date: Fri, 8 Sep 2023 09:56:43 -0400
Lines: 32
Message-ID: <km0ngrFpjpdU1@mid.individual.net>
References: <scrKM.1052734$SuUf.593562@fx14.iad>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net tVcM+LKBIuFJV9kDkYzHAgjUGbRKYyo1ugvSp58F3ABVJwKDQ3
Cancel-Lock: sha1:KufcSlahdqcHP3IoEtoMKOTp63M= sha256:ZtgUKVSPew1nw/FkpXGBHx+o4HMb5KSkNU6grpWJNv4=
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <scrKM.1052734$SuUf.593562@fx14.iad>
 by: Carlos E. R. - Fri, 8 Sep 2023 13:56 UTC

On 2023-09-07 17:24, Charlie Gibbs wrote:
> We have a system consisting of dozens of executables and a number of
> scripts, some of which are run automatically. In the Windows version,
> the executables have a .exe suffix and scripts (a.k.a. batch files)
> have a .bat suffix. So far I've written the Linux version so that
> neither executables nor scripts have a suffix. However, our support
> people want to be able to easily grab copies of all scripts (e.g. for
> backups). If I were to modify the system so that all scripts have a
> .sh suffix, that would satisfy this wish.
>
> I've searched the web in various places (including stackoverflow)
> and found lots of conflicting information over whether a .sh suffix
> is desirable. So I thought I'd throw out the question here.
>
> Just when you thought the Ford vs. Chevy debate had died down...

The system does not care, the humans do.

However, changes on a system "in production" can be disruptive. You may
cause other tools that already know the name of a script to fail. Or you
may decide at some point to recreate a script as a binary and have to
rename the extension.

Also, the backup may miss scripts that don't have the extension
(forgotten), so I'd say that your support system should make the backup
based on other criteria, like examining the start of a file to find out
what type it actually is.

--
Cheers,
Carlos E.R.

Re: Should script files have a .sh suffix?

<op.2aylx3bga3w0dxdave@hodgins.homeip.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=11875&group=comp.os.linux.misc#11875

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dwhodg...@nomail.afraid.org (David W. Hodgins)
Newsgroups: comp.os.linux.misc
Subject: Re: Should script files have a .sh suffix?
Date: Fri, 08 Sep 2023 11:43:05 -0400
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <op.2aylx3bga3w0dxdave@hodgins.homeip.net>
References: <scrKM.1052734$SuUf.593562@fx14.iad>
<udegli$4lp$1@milena.home.net.it>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="b8212571dff65bccb85ae3ae5fdd9390";
logging-data="3697671"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+jXxMWJfAHjrXy4foPMHs5OLToajnOzlw="
User-Agent: Opera Mail/12.16 (Linux)
Cancel-Lock: sha1:grInX3na2B7am2xNwYdBzQiNUBg=
 by: David W. Hodgins - Fri, 8 Sep 2023 15:43 UTC

On Fri, 08 Sep 2023 02:57:54 -0400, Giovanni <lsodgf0@home.net.it> wrote:

> On 9/7/23 23:24, Charlie Gibbs wrote:
>> We have a system consisting of dozens of executables and a number of
>> scripts, some of which are run automatically. In the Windows version,
>> the executables have a .exe suffix and scripts (a.k.a. batch files)
>> have a .bat suffix. So far I've written the Linux version so that
>> neither executables nor scripts have a suffix. However, our support
>> people want to be able to easily grab copies of all scripts (e.g. for
>> backups). If I were to modify the system so that all scripts have a
>> .sh suffix, that would satisfy this wish.
>
> In the Linux/Unix world no suffix is required but executables are
> identified from their file mode being executable. Windows has no such
> file mode and uses the extension to detect a file as executable.

In linux, the extension is not required for the kernel to be able to run
a script. It is required in by some tools such as /etc/profile.

It's required by udev which only loads rules if the file name they are stored
in ends with ".rule". Under systemd there are various extensions used,
..service, .target, .wants, etc. They must be correct or they will not be
processed. There are many other tools that also select files based on the
extension.

So saying "the extension is not required" is true for a script or other
executable run directly by the linux kernel, but not true for things
including scripts selected by various tools.

Regards, Dave Hodgins

Re: Should script files have a .sh suffix?

<nmJKM.1059753$mPI2.793689@fx15.iad>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=11877&group=comp.os.linux.misc#11877

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx15.iad.POSTED!not-for-mail
Newsgroups: comp.os.linux.misc
From: cgi...@kltpzyxm.invalid (Charlie Gibbs)
Subject: Re: Should script files have a .sh suffix?
References: <scrKM.1052734$SuUf.593562@fx14.iad>
<km0ngrFpjpdU1@mid.individual.net>
User-Agent: slrn/1.0.3 (Linux)
Lines: 50
Message-ID: <nmJKM.1059753$mPI2.793689@fx15.iad>
X-Complaints-To: https://www.astraweb.com/aup
NNTP-Posting-Date: Fri, 08 Sep 2023 18:04:03 UTC
Date: Fri, 08 Sep 2023 18:04:03 GMT
X-Received-Bytes: 2855
 by: Charlie Gibbs - Fri, 8 Sep 2023 18:04 UTC

On 2023-09-08, Carlos E. R. <robin_listas@es.invalid> wrote:

> On 2023-09-07 17:24, Charlie Gibbs wrote:
>
>> We have a system consisting of dozens of executables and a number of
>> scripts, some of which are run automatically. In the Windows version,
>> the executables have a .exe suffix and scripts (a.k.a. batch files)
>> have a .bat suffix. So far I've written the Linux version so that
>> neither executables nor scripts have a suffix. However, our support
>> people want to be able to easily grab copies of all scripts (e.g. for
>> backups). If I were to modify the system so that all scripts have a
>> .sh suffix, that would satisfy this wish.
>>
>> I've searched the web in various places (including stackoverflow)
>> and found lots of conflicting information over whether a .sh suffix
>> is desirable. So I thought I'd throw out the question here.
>>
>> Just when you thought the Ford vs. Chevy debate had died down...
>
> The system does not care, the humans do.
>
> However, changes on a system "in production" can be disruptive. You may
> cause other tools that already know the name of a script to fail. Or you
> may decide at some point to recreate a script as a binary and have to
> rename the extension.
>
> Also, the backup may miss scripts that don't have the extension
> (forgotten), so I'd say that your support system should make the backup
> based on other criteria, like examining the start of a file to find out
> what type it actually is.

Thanks for all the opinions. I'm leaning toward adding the .sh suffix
to existing scripts. There aren't that many, and I could even modify
the one that runs every night to update existing ones as required.

Most of our people were born and raised on Windows, and it'll take a
bit of work to wean them off Microsoft's worship of file extensions.
I could shoot their sacred cow with something like

cp -p $(file * | grep script | cut -d: -f1) $BACKUPDIR

although it would be more palatable if they could just say

cp -p *.sh $BACKUPDIR

--
/~\ Charlie Gibbs | They offer a huge range of
\ / <cgibbs@kltpzyxm.invalid> | world-class vulnerabilities
X I'm really at ac.dekanfrus | that only Microsoft can provide.
/ \ if you read it the right way. | -- druck <news@druck.org.uk>

Re: Should script files have a .sh suffix?

<op.2ayw23xwa3w0dxdave@hodgins.homeip.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=11878&group=comp.os.linux.misc#11878

  copy link   Newsgroups: comp.os.linux.misc
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dwhodg...@nomail.afraid.org (David W. Hodgins)
Newsgroups: comp.os.linux.misc
Subject: Re: Should script files have a .sh suffix?
Date: Fri, 08 Sep 2023 15:43:41 -0400
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <op.2ayw23xwa3w0dxdave@hodgins.homeip.net>
References: <scrKM.1052734$SuUf.593562@fx14.iad>
<km0ngrFpjpdU1@mid.individual.net> <nmJKM.1059753$mPI2.793689@fx15.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="93dc9f1fa170903b908230bd0d411f55";
logging-data="3928697"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/SgmTtBmGTwGmy2v1JLTu45ASP+730onI="
User-Agent: Opera Mail/12.16 (Linux)
Cancel-Lock: sha1:yXtIDZdSiq+Bpym7qvcQaCNsZxw=
 by: David W. Hodgins - Fri, 8 Sep 2023 19:43 UTC

On Fri, 08 Sep 2023 14:04:03 -0400, Charlie Gibbs <cgibbs@kltpzyxm.invalid> wrote:
> Most of our people were born and raised on Windows, and it'll take a
> bit of work to wean them off Microsoft's worship of file extensions.
> I could shoot their sacred cow with something like
>
> cp -p $(file * | grep script | cut -d: -f1) $BACKUPDIR
>
> although it would be more palatable if they could just say
>
> cp -p *.sh $BACKUPDIR

The file command is very quick, and just backing up .sh files may miss some
that you would want.

$ time file /etc/profile.d/* |grep exec
/etc/profile.d/10tmpdir.sh: POSIX shell script, ASCII text executable
/etc/profile.d/40configure_keyboard.sh: POSIX shell script, ASCII text executable
/etc/profile.d/60alias.sh: POSIX shell script, ASCII text executable
/etc/profile.d/60qt5.csh: C shell script, ASCII text executable
/etc/profile.d/60qt5.sh: Bourne-Again shell script, ASCII text executable
/etc/profile.d/65qt4.sh: Bourne-Again shell script, ASCII text executable
/etc/profile.d/90qtdir3.sh: Bourne-Again shell script, ASCII text executable
/etc/profile.d/ladspa.csh: C shell script, ASCII text executable
/etc/profile.d/ladspa.sh: POSIX shell script, ASCII text executable
/etc/profile.d/zlocal.sh: POSIX shell script, ASCII text executable

real 0m0.154s
user 0m0.155s
sys 0m0.001s

I'd use file "$BACKUPDIR"/*|grep exec. Note the use of double quotes as windows
users are more likely to use spaces in file and directory names, and then parse
that list for the names of the files to backup.

Regards, Dave Hodgins

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor