Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. TOTALnum=$(wc -l < filesizes.txt);
  2. for i in `seq 1 $TOTALnum`;
  3. do
  4. size=$(sed -n ''$i','$i'p' filesizes.txt)
  5. if [ $size -eq 0 ];
  6. then
  7. echo $(sed -n ''$i','$i'p' filenames.txt);
  8. fi
  9. done;
  10.  
  11. #!/bin/bash
  12. cd;
  13. cd command_manuals;
  14. rm filenames.txt;
  15. ls -1 > filenames.txt;
  16. TOTALnum=$(wc -l < filenames.txt);
  17. for i in `seq 1 $TOTALnum`;
  18. do filename=echo $(sed -n ''$i','$i'p' filenames.txt);
  19. size=$(stat -c '%s' $filename);
  20. if [ $size -eq 0 ];
  21. then
  22. rm $(locate $(sed -n ''$i','$i'p' filenames.txt));
  23. fi
  24. done;
  25.  
  26. Try 'stat --help' for more information.
  27. ./secondpart.sh: line 9: [: -eq: unary operator expected
  28. ./secondpart.sh: line 8: x86_64-linux-gnu-gold.txt: command not found
  29. stat: missing operand
  30.  
  31. #!/bin/bash
  32. cd;
  33. cd command_manuals;
  34. rm filenames.txt;
  35. ls -1 > filenames.txt;
  36. TOTALnum=$(wc -l < filenames.txt);
  37. for i in `seq 1 $TOTALnum`;
  38. do filename=echo $(sed -n ''$i','$i'p' filenames.txt);
  39. size=$(stat -c '%s' $filename);
  40. if [ ${#size} -eq 0 ];
  41. then
  42. rm $(locate $(sed -n ''$i','$i'p' filenames.txt));
  43. fi
  44. done;
  45.  
  46. ./secondpart.sh: line 8: filenames.txt: command not found
  47. stat: missing operand
  48. Try 'stat --help' for more information.
  49. rm: missing operand
  50. Try 'rm --help' for more information.
  51. ./secondpart.sh: line 8: file-roller.txt: command not found
  52. stat: missing operand
  53. Try 'stat --help' for more information.
  54. rm: missing operand
  55. Try 'rm --help' for more information./code>
  56. ./secondpart.sh: line 8: filesizes.txt: command not found
  57. stat: missing operand
  58. Try 'stat --help' for more information.
  59. rm: missing operand
  60. Try 'rm --help' for more information.
  61. ./secondpart.sh: line 8: file.txt: command not found
  62. stat: missing operand
  63. Try 'stat --help' for more information.
  64. rm: cannot remove adammvirtual/Win10UbuntuVM001_apt_sources_file.txt':
  65. No such file or directory
  66. rm: cannot remove '/home/adamvirtual/mapfile.txt': No such file or directory
  67. rm: remove write-protected regular file '/usr/share/doc/alsa-base/driver/Procfile.txt.gz'?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement