This bash script runs on a Mac terminal, it needs to ask the user for input $name
, then replace a string in another file to include the user input PLACEHOLDER_BACKEND_NAME=$name
.
#!/bin/bash read -r name if ! grep -q PLACEHOLDER_BACKEND_NAME="\"$name\"" ~/path-to-file.sh; then perl -pi -e 's/PLACEHOLDER_BACKEND_NAME.*/PLACEHOLDER_BACKEND_NAME=$name/g' ~/psth-to-file.sh fi
The perl replace command fail to take in the value in the $name
variable. I am not familiar with Bash.