Skip to content

Commit 10c837d

Browse files
authored
The current sed script delete everything (#225)
* The current sed script delete everything This easy fix, while not super robust, seems a first good patch * Clean only when there is more then one status * Sync Changelog
1 parent 8b74255 commit 10c837d

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## [Unreleased]
88

9+
### Fixed
10+
- set-status: fix a bug that delete the status (#224)
11+
912
## [0.15.0] 2022-09-11
1013
### Added
1114
- mount-out: new command to remove or unmount a previously mount-in folder or fs

share/pot/set-status.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ _set_status()
4343

4444
echo "pot.status=$_new_status" >> "$_status_file"
4545
# remove first (and outdated) occurrence of pot.status
46-
${SED} -i '' -n -e ":a" \
47-
-e '/^pot\.status=/{n;bc' -e ':c' -e 'p;n;bc' -e '}' \
48-
-e "p;n;ba" "$_status_file"
46+
if [ "$(grep -c "^pot\.status=" "$_status_file")" -gt 1 ]; then
47+
${SED} -i '' -n -e ":a" \
48+
-e '/^pot\.status=/{n;bc' -e ':c' -e 'p;n;bc' -e '}' \
49+
-e "p;n;ba" "$_status_file"
50+
fi
4951
}
5052

5153
pot-set-status()

0 commit comments

Comments
 (0)