Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if [ "$#" -ne 2 ]; then
- echo "Usage: ./script.sh <directory 1> <directory 2>"
- exit 1
- fi
- if [ ! -d $1 ] || [ ! -d $2 ]; then
- echo "At least one of the arguments given is not a directory."
- exit 1
- fi
- destination=$1
- source=$2
- for file in $(ls $source); do
- # jesli plik nie jest katalogiem ani symlinkiem
- if [ ! -d $source/$file ] && [ ! -L $source/$file ]; then
- ln $(realpath "$source/$file") $destination/$file # link w postaci kanonicznej
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement