vista-modpack/scripts/sort-modlist

25 lines
604 B
Plaintext
Raw Permalink Normal View History

#!/bin/sh
# Sorts the modlist.txt file in one of the module directories.
# EJB 11/5/2015
if [ "x$1" = "x" ]; then
echo "Usage: $0 directory-name"
exit 1
fi
dir=$1
if [ ! -d $dir ]; then
echo "$0: $dir is not a directory"
exit 1
fi
if [ ! -f $dir/modlist.txt ]; then
echo "$0: modlist.txt not found in $dir"
exit 1
fi
[ -f $dir/modlist.txt.old ] && rm $dir/modlist.txt.old
[ -f $dir/modlist.txt.new ] && rm $dir/modlist.txt.new
sort $dir/modlist.txt > $dir/modlist.txt.new
mv $dir/modlist.txt $dir/modlist.txt.old
mv $dir/modlist.txt.new $dir/modlist.txt
rm $dir/modlist.txt.old
exit 0