diff --git a/CHANGELOG.md b/CHANGELOG.md index 8500590..8d8828f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Fixed +- set-status: fix a bug that delete the status (#224) + ## [0.15.0] 2022-09-11 ### Added - mount-out: new command to remove or unmount a previously mount-in folder or fs diff --git a/share/pot/set-status.sh b/share/pot/set-status.sh index 580fe3c..f7dfcf8 100644 --- a/share/pot/set-status.sh +++ b/share/pot/set-status.sh @@ -43,9 +43,11 @@ _set_status() echo "pot.status=$_new_status" >> "$_status_file" # remove first (and outdated) occurrence of pot.status - ${SED} -i '' -n -e ":a" \ - -e '/^pot\.status=/{n;bc' -e ':c' -e 'p;n;bc' -e '}' \ - -e "p;n;ba" "$_status_file" + if [ "$(grep -c "^pot\.status=" "$_status_file")" -gt 1 ]; then + ${SED} -i '' -n -e ":a" \ + -e '/^pot\.status=/{n;bc' -e ':c' -e 'p;n;bc' -e '}' \ + -e "p;n;ba" "$_status_file" + fi } pot-set-status()