Deutsch   English   Français   Italiano  
<uc57fv$tga$1@shakotay.alphanet.ch>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder8.news.weretis.net!news.imp.ch!news.alphanet.ch!alphanet.ch!.POSTED!not-for-mail
From: Marc SCHAEFER <schaefer@alphanet.ch>
Newsgroups: fr.comp.os.unix
Subject: Re: shells et =?ISO-8859-1?Q?op=E9rations?= sur le texte
Date: Wed, 23 Aug 2023 15:09:51 -0000 (UTC)
Organization: Posted through news.alphanet.ch
Message-ID: <uc57fv$tga$1@shakotay.alphanet.ch>
References: <uc2ai6$2dkat$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 23 Aug 2023 15:09:51 -0000 (UTC)
Injection-Info: shakotay.alphanet.ch; posting-account="schaefer";
	logging-data="30218"; mail-complaints-to="usenet@alphanet.ch"; posting-host="634ce6c9682d817d72f6177875e2bb4f.nnrp.alphanet.ch"
User-Agent: tin/2.4.3-20181224 ("Glen Mhor") (UNIX) (Linux/4.19.0-25-amd64 (x86_64))
Cancel-Lock: sha256:N+CyM/N10Lljb4NKIzTfJRO+45FtPzJmc4Jw8guICoQ= sha256:e+IfnQP2H8I4n+sbz5zaPwWti+beZDvszmEa0cybNs4=
Bytes: 2747
Lines: 44

On Tue, 22 Aug 2023 14:43:50, Thomas <fantome.forums.tDeContes@free.fr.invalid> wrote:
> fuseauHoraire="${fuseauHoraire:0:1} 10#${fuseauHoraire:1:2} *60*60"

Il se peut que ce genre de "parameter expansions" ne soient pas du POSIX
shell, mais du dialecte bash.

Dans ce cas, mettre

#! /bin/bash

au début du fichier. (oui, j'aime bien l'espace et ça marche quand même,
mais #!/bin/bash est plus classique).

Dans le monde d'aujourd'hui, une dépendance à /bin/bash ne me semble pas
bizarre.  Il y a très longtemps, on écrivait plutôt du code shell
simplifié pour la portabilité avec les UNIX un peu étranges. Ou on
passait à Perl.

> sur mon nouveau pc, avec Ubuntu 22, il dit "Bad substitution".
> Si je supprime "#!/bin/sh -", ça marche. (cad, si je comprend bien, si 
> je reste explicitement en bash.)

Ubuntu est basé sur Debian.

Debian a le concept d'alternative, qui permet à l'administrateur système
de décider si /bin/sh est un mini-shell très efficace et simplifié, ou
le gros /bin/bash.

Exemple ici:

   schaefer@reliant:~$ dpkg-divert --list | grep dash
   diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by dash
   diversion of /bin/sh to /bin/sh.distrib by dash

/bin/sh est bien dash, pas bash.

C'est configurable à la main avec dpkg-divert (sous root), ou alors, de
mémoire avec dpkg-reconfigure -plow dash (également sous root).

Mais si tu mets /bin/bash dans le she-bang (#!), aucun problème.

-- 
Attention: limitez le nombre de lignes de citation à l'essentiel, sinon
je ne verrai pas votre réponse. Et si vous écrivez souvent des bobards,
je ne vous lirai plus et je recommanderai (NoCeM) de ne plus vous lire.