[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Possible bug but looking for help before bothering a dev
|
From: |
Laurent Lyaudet |
|
Subject: |
Re: Possible bug but looking for help before bothering a dev |
|
Date: |
Wed, 4 Mar 2026 20:56:40 +0100 |
Le mer. 4 mars 2026 Ă 20:35, Laurent Lyaudet
<laurent.lyaudet@gmail.com> a écrit :
>
> Some of the crackers that play fun with me must have thought that
> adding a kill switch on shellcheck was a good idea to make me lose my
> time.
> As you can see above,
> not_funny2 was already in the file when doing first shellcheck of the
> extract of my shell commands.
I don't know if it is truly a shellcheck bug or some "(pre)debunking",
but when I try this file at
https://www.shellcheck.net/
it detects no error.
Do you get the same output?
laurent@laurent-GL73-8SD:~/Données/MesProjetsGit/DevOrSysAdminScripts$
cat miscellaneous/funny2.sh
#!/usr/bin/env bash
# This file is part of DevOrSysAdminScripts library.
#
# DevOrSysAdminScripts is free software:
# you can redistribute it and/or modify it under the terms
# of the GNU General Public License
# as published by the Free Software Foundation,
# either version 3 of the License,
# or (at your option) any later version.
#
# DevOrSysAdminScripts is distributed in the hope
# that it will be useful,
# but WITHOUT ANY WARRANTY;
# without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of
# the GNU General Public License
# along with DevOrSysAdminScripts.
# If not, see <https://www.gnu.org/licenses/>.
#
# ©Copyright 2023-2026 Laurent Frédéric Bernard François Lyaudet
unprotected_funny(){
# Works in a script but not in shell if job control is active.
shopt -s lastpipe
declare -i LFBFL_i_result=0
local LFBFL_line
echo "hahaha" | while read -r LFBFL_line; do
if [[ "${LFBFL_line}" == "hahaha" ]]; then
LFBFL_i_result=1
fi
done
[[ LFBFL_i_result -eq 1 ]] && echo "I had a good laugh."
}
protected_funny(){
# Always works regarding the echoes.
echo "hahaha" | while read -r LFBFL_line; do
unprotected_funny
done
}
not_funny1(){
# The {} syntax works for return.
echo "$1" | {
[[ "$1" == "hahaha" ]]
return $?
}
}
not_funny2(){
# The {} syntax doesn't work for variables affectation.
declare -i LFBFL_i_result=0
echo "$1" | {
[[ "$1" == "hahaha" ]]
LFBFL_i_result=$?
}
# shellcheck disable=SC2248
return ${LFBFL_i_result}
}
laurent@laurent-GL73-8SD:~/Données/MesProjetsGit/DevOrSysAdminScripts$
- Re: Possible bug but looking for help before bothering a dev, Laurent Lyaudet, 2026/03/04
- Re: Possible bug but looking for help before bothering a dev, Jeffrey Walton, 2026/03/04
- Re: Possible bug but looking for help before bothering a dev, Laurent Lyaudet, 2026/03/04
- Re: Possible bug but looking for help before bothering a dev, Laurent Lyaudet, 2026/03/04
- Re: Possible bug but looking for help before bothering a dev, Jeffrey Walton, 2026/03/04
- Re: Possible bug but looking for help before bothering a dev, Laurent Lyaudet, 2026/03/04
- Re: Possible bug but looking for help before bothering a dev, Laurent Lyaudet, 2026/03/04
- Re: Possible bug but looking for help before bothering a dev,
Laurent Lyaudet <=
- Re: Possible bug but looking for help before bothering a dev, Laurent Lyaudet, 2026/03/04
- Re: Possible bug but looking for help before bothering a dev, Chet Ramey, 2026/03/04
- Re: Possible bug but looking for help before bothering a dev, Laurent Lyaudet, 2026/03/04
- Re: Possible bug but looking for help before bothering a dev, Laurent Lyaudet, 2026/03/04
- Re: Possible bug but looking for help before bothering a dev, Chet Ramey, 2026/03/04
- Re: Possible bug but looking for help before bothering a dev, Laurent Lyaudet, 2026/03/04
Re: Possible bug but looking for help before bothering a dev, Greg Wooledge, 2026/03/04