I need to build a string of --build-arg parameter using some key/value pairs (build.args file) in a busybox shell:
script.sh
#!/bin/sh
one=$1
two=$2
shift
while IFS= read -r line; do
set "$@" --build-arg "$line"
done < "build.args"
echo "$@"
build.args
ONE=first
TWO=second
Running sh script.sh foo bar (yes, two parameters are needed for the script) should read the content of build.args and add the key/value pairs as --build-arg parameter and output this generated string. This is what I am expecting:
--build-arg ONE=first --build-arg TWO=second
But with my script I do get
bar --build-arg ONE=first --build-arg TWO=second
as bar is passed as second parameter in the script call.