Guest User

Untitled

a guest
Jun 26th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.57 KB | None | 0 0
  1. #!/bin/bash
  2. # Test AA findstr bug
  3.  
  4. MARK=---\>
  5. MARK2=-\>
  6.  
  7. FIRST_LINE=2G
  8.  
  9. printf "Testing behaviour of powershell \033[1mfindstr\033[0m\n"
  10.  
  11. TMPDIR=/mnt/c/temp/
  12. FILE1=$(mktemp -t ${0##*/}.temp.XXXXXXXXXXX)
  13. FILE2=$(mktemp -t ${0##*/}.temp.XXXXXXXXXXX)
  14. trap 'for file in "$FILE1" "$FILE2"; do [ -e "$file" ]  && rm "$file"; done' EXIT
  15. FILE_NAME1=${FILE1##*/}
  16. FILE_NAME2=${FILE2##*/}
  17.  
  18. c=
  19. echo \
  20. "$((c++))$MARK Created temp files:
  21. $FILE1
  22. $FILE2"
  23.  
  24. printDoubleCaps ()
  25. {
  26. #   echo {0..9}{0..9}; return
  27. #   echo {a..z}{a..z}; return
  28.     for i in $(seq 1 27 676); do
  29.         echo {A..Z}{A..Z} |
  30.         cut -d ' ' -f $i
  31.     done
  32. }
  33.  
  34. echo "$MARK Input:" $(printDoubleCaps)
  35. echo "$MARK Starting test loop"
  36.  
  37. for i in $(printDoubleCaps); do
  38.  
  39.     printf "$MARK \033[31mInput \033[1m%s\033[0m %s\n" $((c++)) [$i]
  40.     echo "$MARK Writing files.."
  41.     echo "${i:0:1}$FIRST_LINE"  > "$FILE1"
  42. #   echo blahalah           >> "$FILE1"
  43.     echo -n $i          >> "$FILE1"
  44.  
  45.     echo "${i:0:1}$FIRST_LINE"  > "$FILE2"
  46. #   echo bolooloolo         >> "$FILE2"
  47.     echo -n $i          >> "$FILE2"
  48.  
  49.  
  50.     printf %b\\n "$MARK ..Files written"
  51.     printf %s\\n "$MARK cat files (colon is end of file)$MARK2"
  52.     cat "$FILE1"; printf %s :; cat "$FILE2"; printf %s :
  53.  
  54.     echo ''
  55.  
  56.     printf %s\\n "$MARK hexdump of files$MARK2"
  57.     hexdump -c "$FILE1"; hexdump -c "$FILE2"
  58.  
  59.     echo ''
  60.  
  61.     printf "%b\n" "$MARK \033[93mOutput\033[0m of \033[36mfindstr /v /G:<file1> <file2>\033[0m (powershell.exe)$MARK2"
  62.     powershell.exe 'findstr /v /G:C:\temp\'"$FILE_NAME1"' C:\temp\'"$FILE_NAME2"
  63.     echo ''
  64.     printf %b\\n "$MARK \033[93mend of output\033[0m"
  65.     echo ''
  66. done
Advertisement
Add Comment
Please, Sign In to add comment