1. Directories are binded if they don't exist, otherwise we recurse to a subdirectory.
2. Files in non bound directories are symbolically linked
3. Symbolic Links are copied.
Not Implemented is checking copied symbolic links and repairing any errors if any. The script run and successfully binds the directories via recursion. I haven't tested it yet though with running programs and it is very preliminary.
I also want to be able to create exceptions for various directories and maybe allow some special case handling of certain directors based on a configuration directory (or file).
One difficulty I had was trying to work with the "Null Character" as a field separator. This took me lots of trial and error and I still don't really understand it. I didn't find any good examples or tutorials on this but there were some stackoverflow discussions to give me hints.
What worked for me is to create a function to do string substitution in a pipe, which I made as a seperate file in my search path called removePrefix
Code: Select all
#!/bin/bash
#bla=$IFS
#FS=$'\0'
while read -r -d '' a; do
echo "a=$a">>/mnt/sdc6/removePrefixLog
echo "${a#$1}"
echo "${a#$1}">>/mnt/sdc6/removePrefixLog
done
Code: Select all
DIRS2=( $( find $SR$one -mindepth 1 -maxdepth 1 -print0 -name '*' | removePrefix "$SR" ) )#