SHARE
TWEET

WDI-Zad4

BusioMeister Jan 14th, 2020 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. echo "Skrypt do zadania 4 - znajdowanie i usuwanie dowiazan"
  3. if [ -z "$1" ]
  4. then
  5.     echo "Jako pierwszy argument podaj sciezke!"
  6.     exit 1
  7. fi
  8. if [ ! -e "$1" ] || [ ! -d "$1" ]
  9. then
  10.     echo "Plik nie istnieje lub nie jest sciezka!"
  11.     exit 2
  12. fi
  13. echo "Sciezka: " $1
  14. separator=" | "
  15. lista=""
  16. find $1 -type l | { while read -s line ; do
  17.     wskazanie=$(readlink -f $line)
  18.     zasieg=""
  19.     if [[ $wskazanie =~ $1 ]]
  20.     then
  21.         zasieg="Wewnetrzne"
  22.         rm $line
  23.     else       
  24.         zasieg="Zewnetrzne"
  25.     fi
  26.     lista+="\n$line $separator $wskazanie $separator $zasieg"
  27. done
  28. echo -e $lista | sort
  29. }
  30. exit 0
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top