Files
templates/test.sh
2023-10-08 18:30:46 -07:00

24 lines
445 B
Bash
Executable File

#!/usr/bin/bash
git rev-parse --abbrev-ref HEAD > branch.txt
read -r BRANCH <"branch.txt"
echo $BRANCH
rm branch.txt
git diff --dirstat main $BRANCH ./* > diff.txt
echo "*** diff.txt ***"
cat diff.txt
# Use sed to remove characters before the match pattern
match_pattern=' '
sed "s/.*$match_pattern/$match_pattern/" "diff.txt" > changed.txt
echo "*** changed.txt ***"
cat changed.txt
read -r CHDIR <"changed.txt"
echo $CHDIR
cd $CHDIR
pwd