Handle unpresence of .env better

This commit is contained in:
Felipe Santos
2022-06-18 22:20:41 -03:00
parent 7bb4386b65
commit 8cfbe3958a
+1 -1
View File
@@ -7,7 +7,7 @@ readonly wanted_line="${wanted_line_key}='${PWD}'"
readonly file=".env"
echo "Writing ${wanted_line} to ${file}" >&2
if grep --quiet "^${wanted_line_key}=" "${file}"; then
if [[ -f "${file}" ]] && grep --quiet "^${wanted_line_key}=" "${file}"; then
sed --in-place "s,^${wanted_line_key}=.*,${wanted_line}," "${file}"
else
echo "LOCAL_WORKSPACE_FOLDER='${PWD}'" >"${file}"