Advertisement
KristianIvanov00

Untitled

May 3rd, 2023 (edited)
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. mkdir 20118025
  2. cd 20118025
  3. mkdir documents documents/results scripts
  4. cd documents/
  5. touch file1.doc file2.doc file3.doc file4.doc
  6. cd ../scripts/
  7. touch script.sh
  8. cd ..
  9. chmod 771 scripts/* scripts
  10. cd results/
  11. touch count
  12. cd ..
  13. cd scripts/
  14. vi script.sh
  15. #!/bin/bash
  16. # Count the number of files in the documents directory
  17. num_files=$(ls ../documents | wc -l)
  18.  
  19. # Write the result to a file named count in the results directory
  20. echo $num_files > ../documents/results/count
  21.  
  22. # List all directories in the documents folder and save the result in a file
  23. #!/bin/bash
  24. cd ../documents/results
  25. cd ..
  26. ls -d */ > ./results/files
  27.  
  28. #List all files with .png extension
  29. #!/bin/bash
  30. cd ../results
  31. touch test
  32. cd ..
  33. ls -l img/ | egrep '\.png$' > results/test
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement