From adad22f879c9cfdb2b99716977941e2dbcefbb5e Mon Sep 17 00:00:00 2001 From: Bart Slinger Date: Wed, 26 Sep 2018 19:53:46 +0200 Subject: [PATCH] make set function work in sh --- platforms/posix/src/px4-alias.sh_in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platforms/posix/src/px4-alias.sh_in b/platforms/posix/src/px4-alias.sh_in index ad79af4c79..351f8a91db 100644 --- a/platforms/posix/src/px4-alias.sh_in +++ b/platforms/posix/src/px4-alias.sh_in @@ -9,9 +9,11 @@ fi # Map the NuttX-style variable definition 'set ' to something that # bash and alternatives understand -set() { +# define _set first because sh does not like overwriting set directly +_set() { eval $1=$2 } +alias set=_set # alternative method with an alias: # alias set='f(){ set -- "$1=$2"; eval "$1"; unset -f f; }; eval f'