Advertisement
Korobka887

ебучее говно на которое убил 4 часа

Feb 28th, 2023 (edited)
917
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.70 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. read filepath
  4. read str1
  5. read str2
  6.  
  7. if [ -z "$filepath" ] || [ -z "$str1" ] || [ -z "$str2" ] || [ "$str1" == "$str2" ];
  8. then
  9.     echo "Строки не корректны"
  10. else
  11.     if [ -f files.log ] && [ -f $filepath ]
  12.     then
  13.         if grep -q "$str1" $filepath;
  14.         then
  15.             sed -i "" -e "s/$str1/$str2/g" $filepath
  16.            
  17.             filesize=$(stat -f %z $filepath);
  18.             date=$(date +"%Y-%m-%d %H:%M")
  19.             sha=$(echo $filepasth | shasum -a 256 );
  20.            
  21.            
  22.             echo $filepath" - "$filesize" - "$date" - "$sha" sha256" >> files.log
  23.         fi
  24.     fi
  25.     echo "files.log или "$filepath" не найден"
  26. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement