tanmaydeo commited on
Commit
554e6b0
·
verified ·
1 Parent(s): 8b947fc

Upload OSWorld-assets/multi_apps/b337d106-053f-4d37-8da0-7f9c4043a66b-eval-user-backup.sh with huggingface_hub

Browse files
OSWorld-assets/multi_apps/b337d106-053f-4d37-8da0-7f9c4043a66b-eval-user-backup.sh CHANGED
@@ -3,20 +3,26 @@
3
  # Passes only if:
4
  # (1) the live ~/.vimrc enables absolute line numbers, AND
5
  # (2) a backup of the ORIGINAL vimrc exists whose CONTENT matches the seeded
6
- # baseline (marker present) and which does NOT yet enable line numbers
7
- # (i.e. it is the pre-modification copy, proving real backup content).
 
8
  VIMRC="$HOME/.vimrc"
9
  NUM_RE='^[[:space:]]*:?[[:space:]]*set[[:space:]]+(number|nu)([[:space:]]|$)'
10
 
11
  hasnum=0
12
  [ -f "$VIMRC" ] && grep -Eq "$NUM_RE" "$VIMRC" && hasnum=1
13
 
14
- backup=$(find "$HOME" -maxdepth 2 \( -iname '.vimrc.*' -o -iname '*vimrc*.bak' -o -iname '*vimrc*.backup' -o -iname '*vimrc*.orig' -o -iname '*vimrc*.save' -o -iname '*vimrc*.old' -o -iname '.vimrc~' \) 2>/dev/null | head -1)
15
-
16
  backup_ok=0
17
- if [ -n "$backup" ] && grep -q 'OSWORLD_BASELINE_VIMRC' "$backup" && ! grep -Eq "$NUM_RE" "$backup"; then
18
- backup_ok=1
19
- fi
 
 
 
 
 
 
 
20
 
21
  if [ "$hasnum" -eq 1 ] && [ "$backup_ok" -eq 1 ]; then
22
  echo "The File Has Set Number!"; exit 0
 
3
  # Passes only if:
4
  # (1) the live ~/.vimrc enables absolute line numbers, AND
5
  # (2) a backup of the ORIGINAL vimrc exists whose CONTENT matches the seeded
6
+ # baseline IN FULL (marker 'OSWORLD_BASELINE_VIMRC' + 'syntax on' +
7
+ # 'set tabstop=4') and which does NOT enable line numbers -- i.e. it is the
8
+ # true pre-modification copy, not a marker-only stub.
9
  VIMRC="$HOME/.vimrc"
10
  NUM_RE='^[[:space:]]*:?[[:space:]]*set[[:space:]]+(number|nu)([[:space:]]|$)'
11
 
12
  hasnum=0
13
  [ -f "$VIMRC" ] && grep -Eq "$NUM_RE" "$VIMRC" && hasnum=1
14
 
 
 
15
  backup_ok=0
16
+ while IFS= read -r backup; do
17
+ [ -z "$backup" ] && continue
18
+ if grep -q 'OSWORLD_BASELINE_VIMRC' "$backup" \
19
+ && grep -Eq '^[[:space:]]*syntax[[:space:]]+on[[:space:]]*$' "$backup" \
20
+ && grep -Eq '^[[:space:]]*set[[:space:]]+tabstop=4[[:space:]]*$' "$backup" \
21
+ && ! grep -Eq "$NUM_RE" "$backup"; then
22
+ backup_ok=1
23
+ break
24
+ fi
25
+ done < <(find "$HOME" -maxdepth 2 \( -iname '.vimrc.*' -o -iname '*vimrc*.bak' -o -iname '*vimrc*.backup' -o -iname '*vimrc*.orig' -o -iname '*vimrc*.save' -o -iname '*vimrc*.old' -o -iname '.vimrc~' \) 2>/dev/null)
26
 
27
  if [ "$hasnum" -eq 1 ] && [ "$backup_ok" -eq 1 ]; then
28
  echo "The File Has Set Number!"; exit 0