kolorowytoster

SOP08

May 8th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.63 KB | None | 0 0
  1. ===ZAD 1===
  2.  
  3. echo "Szukanie plików w "$PWD
  4. files=$(ls -p | egrep "[/]$")
  5. for file in $files; do
  6.   ls -al ./$file | egrep "\-r.*" > /dev/null
  7.   if [[ $? -eq 0 ]]; then
  8.     echo $file
  9.   fi
  10. done
  11. exit 0
  12.  
  13. ===ZAD 2===
  14.  
  15. #!/usr/bin/env bash
  16. if [[ $# -eq 0 ]]; then
  17.   echo "Podaj argumenty."
  18. else
  19.   liczbaArgumentow=$#
  20.   for (( i = 0; i < $liczbaArgumentow; i++ )); do
  21.     if [[ ! -r $1 ]]; then
  22.       echo $1" nie jest do odczytu"
  23.     else
  24.       echo $1
  25.       files=$(cat $1 | egrep " CPU[ ,.]")
  26.       count=0
  27.       for file in $files; do
  28.         let count=count+1
  29.       done
  30.       echo $count
  31.     fi
  32.     shift 1
  33.   done
  34. fi
Advertisement
Add Comment
Please, Sign In to add comment