./setup.sh: line 114: [: -ne: unary operator expected
このエラーが出ているのは,114行目ではなく,104行目ですね.
if [ "\${exit_code}" -ne 0 ]; then
たぶん,文字列として扱っているからおかしいのかと思います.
(Fedoraは,これでいけるのかなぁ)
これ,eval の中(ダブルクォーテーションの中)で使っていますね.
とすると,ダブルクォーテーションを回避した方が良い気がします.
eval の中のダブルクォーテーションの前に「\」をつけてエスケープしましょう.
eval "rc_start_$func_name() {
echo 'Starting ${func_name}'
\${REFBOX_COMPOSE_COMMAND} -f \${rcll_compose_files_dir}/${func_name}.yaml up -d
# Check if the exit code variable is set
if [ -n \"\${exit_code}\" ]; then
# Check if the exit code is not equal to 0
if [ \"\${exit_code}\" -ne 0 ]; then
# Do something if the exit code is not 0
echo \"Error: The exit code is not 0\"
fi
else
# Handle the case when the exit code variable is not set
echo \"Exit code is not sett\"
fi
コメントを残す