mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 00:53:34 +08:00
posix shell: use /bin/sh instead of bash
This uses the systems default shell: - Ubuntu: dash - Fedora: bash Since bash is invoked via /bin/sh, it operates in POSIX mode: https://tiswww.case.edu/php/chet/bash/POSIX - remove '# Ignore the expand_aliases command in zshell.' Not needed because the shell operates in POSIX mode - [[ is bashism -> use [ - autostart_files=( $autostart_file_match ) is not supported in dash, so use 'ls' - shellcheck runs the dash flavor, since dash is a minimalistic shell. Tested on dash & bash.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
# shellcheck disable=SC1091
|
||||
. px4-alias.sh
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
SCRIPT_DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)"
|
||||
|
||||
#
|
||||
# Main SITL startup script
|
||||
@@ -149,10 +149,7 @@ then
|
||||
fi
|
||||
|
||||
# Autostart ID
|
||||
autostart_file_match="etc/init.d-posix/$(param show -q SYS_AUTOSTART)_*"
|
||||
# shellcheck disable=SC2206
|
||||
autostart_files=( $autostart_file_match )
|
||||
autostart_file="${autostart_files[0]}" # use first match, but there should really only be one
|
||||
autostart_file=$( ls -- etc/init.d-posix/"$(param show -q SYS_AUTOSTART)"_* )
|
||||
if [ ! -e "$autostart_file" ]; then
|
||||
echo "Error: no autostart file found"
|
||||
exit -1
|
||||
|
||||
Reference in New Issue
Block a user