Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- # Add file to the /Syncs Git Repository
- # Run cmd: bash /Scripts/Git/git-adddbox.sh
- fstfilt=".dropbox"
- secfilt=".git"
- trdfilt=".kde"
- dboxsrc="/home/files/dbox_dump.txt"
- dboxout="/home/files/dbox_redump.txt"
- curdir=$PWD;
- echo "Working Dir => '$curdir'";
- cd /Syncs;
- git init;
- git config user.name "$USER";
- git config user.email "tbotnik@gmail.com"
- git branch 'Syncs';
- git checkout 'Syncs';
- while IFS= read -r line
- do
- dtmp=${line%%$fstfilt}
- gtmp=${line%%$secfilt}
- ttmp=${line%%$trdfilt}
- dpos=${#dtmp}
- gpos=${#gtmp}
- tpos=${#ttmp}
- echo $dpos $gpos $tpos $line
- if [[ $dpos -eq 0 && $gpos -eq 0 && $tpos -eq 0 ]]; then
- echo $dpos $gpos $tpos $line
- # else
- # git add $line
- fi
- done < "$dboxsrc"
- cd $curdir;
- Lines 21-26 do not process correctly according to BASH tutorials, which say they will give the position of the substring in the "linw" variable. I need a surefire way to get the substring position.
- Wondering if instead of:
- fstfilt=".dropbox"
- secfilt=".git"
- trdfilt=".kde"
- I really need:
- fstfilt="\.dropbox"
- secfilt="\.git"
- trdfilt="\.kde"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement