daily pastebin goal
48%
SHARE
TWEET

Untitled

a guest Mar 25th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. if [ "$#" -ne 2 ]; then
  4.     echo "Usage: ./script.sh <directory 1> <directory 2>"
  5.     exit 1
  6. fi
  7.  
  8. if [ ! -d $1 ] || [ ! -d $2 ]; then
  9.     echo "At least one of the arguments given is not a directory."
  10.     exit 1
  11. fi
  12.  
  13. destination=$1
  14. source=$2
  15.  
  16. for file in $(ls $source); do
  17.     # jesli plik nie jest katalogiem ani symlinkiem
  18.     if [ ! -d $source/$file ] && [ ! -L $source/$file ]; then
  19.         ln $(realpath "$source/$file") $destination/$file # link w postaci kanonicznej
  20.     fi
  21. done
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