Skip to content

Instantly share code, notes, and snippets.

@syui
Created September 24, 2014 10:47
Show Gist options
  • Save syui/d902365e0ab80d90f48b to your computer and use it in GitHub Desktop.
Save syui/d902365e0ab80d90f48b to your computer and use it in GitHub Desktop.
#!/bin/zsh
dir=$HOME/Music
cha=`cat $dir/info.txt | grep FILE | tail -n 1 | cut -d '/' -f 6`
# cha=`cat $dir/info.txt | grep FILE | tail -n 1 | xargs basename`
sum=`echo $cha | wc -c | tr -d ' '`
fil=$dir/info.s
if [ -e $fil ]; then
i=`cat $fil | tail -n 1`
if [ $i -le $sum ]; then
a=`expr $i + 4`
b=$i"-"$a
c=`cat $dir/info.txt | grep FILE | tail -n 1 | cut -d '/' -f 6 | cut -b $b | tr -d '\n'` > /dev/null
echo -ne "$c"
echo $a >> $fil
else
c=`cat $dir/info.txt | grep FILE | tail -n 1 | cut -d '/' -f 6 | cut -b 1-4 | tr -d '\n'` > /dev/null
echo -ne "$c"
rm $fil
fi
else
c=`cat $dir/info.txt | grep FILE | tail -n 1 | cut -d '/' -f 6 | cut -b 1-4 | tr -d '\n'` > /dev/null
echo -ne "$c"
echo 1 > $fil
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment