Advertisement
STANAANDREY

solab1pb4

Feb 23rd, 2024
1,262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.27 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. if [ $# -ne 2 ]; then
  4.     echo "Usage: $0 <dir> <char>"
  5.     exit 1
  6. fi
  7.  
  8. dir=$1
  9. char=$2
  10.  
  11. if [ ! -d $dir ]; then
  12.     echo "$dir isn't a dir"
  13.     exit 1
  14. fi
  15.  
  16. list=$(find $dir -type f -name *.txt)
  17.  
  18. for file in $list
  19. do
  20.     chmod a+$char $file
  21. done
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement