I am trying to run a .sh file by passing few arguments. The file contains the following.
# escape special characters
ESCAPED_REPLACE=$(printf '%s ' "$@" | sed -e 's/[$()"]/\\&/g')
echo "After replace"
echo $ESCAPED_REPLACE
npx codeceptjs "$ESCAPED_REPLACE" --plugins allure
Following is a sample list of arguments. As it shows the last argument contains double quotes. Which I need to preserve here
./test.sh run --steps --grep "Verifying login"
The issue is once I print the ESCAPED_REPLACE the quotes are lost. Does anyone know why?