From 83e2ee60c937281937e968d8e6f32ba6961355fb Mon Sep 17 00:00:00 2001 From: Kai Stevenson Date: Wed, 7 Jun 2023 16:01:56 -0700 Subject: QOL --- syncmusic-interactive | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'syncmusic-interactive') diff --git a/syncmusic-interactive b/syncmusic-interactive index 8aa353b..b9d608d 100755 --- a/syncmusic-interactive +++ b/syncmusic-interactive @@ -54,6 +54,7 @@ do done " > /tmp/remotemusiclist +touch /tmp/localonlymusicd LOCALONLYCOUNT=0 LOCALONLYMUSIC=() UNSYNCCOUNT=0 @@ -89,6 +90,10 @@ done < /tmp/remotemusiclist echo -e $WHITE echo "Discovered $UNSYNCCOUNT unsynced albums" +if [ $UNSYNCCOUNT = 0 ] +then + exit +fi echo "Albums in BLUE are those that are only on the local machine. Albums in GREEN are those that are only on the remote machine. Albums in WHITE are those that are on both" read -p "Enter the indexes corresponding to the albums you wish to sync, separated by spaces: " INPUT @@ -99,19 +104,19 @@ do FDIR=$LOCALDIR/${LOCALONLYMUSIC[$((j-1))]} TDIR=$REMOTE:$REMOTEDIR/${LOCALONLYMUSIC[$((j-1))]} COMMAND="rsync -avzP --mkpath $FDIR $TDIR" - echo $COMMAND >> /tmp/syncmusictorun + echo "$COMMAND" >> /tmp/syncmusictorun else FDIR=$REMOTE:$REMOTEDIR/${REMOTEONLYMUSIC[$(($j-$LOCALONLYCOUNT-1))]} TDIR=$LOCALDIR/${REMOTEONLYMUSIC[$(($j-$LOCALONLYCOUNT-1))]} COMMAND="rsync -avzP --mkpath $FDIR $TDIR" - echo $COMMAND >> /tmp/syncmusictorun + echo "$COMMAND" >> /tmp/syncmusictorun fi done echo "WILL RUN: $(cat /tmp/syncmusictorun)" read -p "Enter y to confirm: " CONFIRM if [[ $CONFIRM = y ]] then - $(cat /tmp/syncmusictorun) + source /tmp/syncmusictorun fi rm /tmp/remotemusiclist rm /tmp/localmusiclist -- cgit v1.3.1