1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-07-31 00:03:08 +03:00

os400: fix shellcheck warnings in scripts

- use `$()` instead of backticks, and re-arrange double-quotes inside.
- add missing `|| exit 1` to `cd` calls. (could be dropped by using `set -eu`.)
- add `-n` to a few `if`s.
- shorten redirections by using `{} >` (as shellcheck recommended).
- silence warnings where variables were detected as unused (SC2034).
- a couple misc updates to silence warnings.
- switch to bash shebang for `-ot` feature.
- split two lines to unbreak syntax highlighting in my editor. (`$(expr \`, `$(dirname \`)

Also enable CI checks for OS/400 shell scripts.

Ref: d88b9bcdaf
Closes #1358
This commit is contained in:
Viktor Szakats
2024-04-08 13:49:23 +00:00
parent 6a2f5f2736
commit c6625707b9
7 changed files with 88 additions and 82 deletions

10
os400/make-include.sh Normal file → Executable file
View File

@ -1,13 +1,13 @@
#!/bin/sh
#!/usr/bin/env bash
# Copyright (C) The libssh2 project and its contributors.
# SPDX-License-Identifier: BSD-3-Clause
#
# Installation of the header files in the OS/400 library.
#
SCRIPTDIR=`dirname "${0}"`
SCRIPTDIR=$(dirname "${0}")
. "${SCRIPTDIR}/initscript.sh"
cd "${TOPDIR}/include"
cd "${TOPDIR}/include" || exit 1
# Create the OS/400 source program file for the header files.
@ -47,11 +47,11 @@ copy_hfile()
# Copy the header files.
for HFILE in *.h "${TOPDIR}/os400/libssh2_ccsid.h"
do DEST="${SRCPF}/`db2_name \"${HFILE}\"`.MBR"
do DEST="${SRCPF}/$(db2_name "${HFILE}").MBR"
if action_needed "${DEST}" "${HFILE}"
then copy_hfile "${DEST}" "${HFILE}"
IFSDEST="${IFSINCLUDE}/`basename \"${HFILE}\"`"
IFSDEST="${IFSINCLUDE}/$(basename "${HFILE}")"
rm -f "${IFSDEST}"
ln -s "${DEST}" "${IFSDEST}"
fi