Mercurial > ec-dotfiles
view bin/moeauto @ 365:3e62b13e1f48
Better test for rm aliasing
Check for GNU rm availability and whether the rm (GNU or not) has -I parameter.
author | Edho Arief <edho@myconan.net> |
---|---|
date | Mon, 04 Jun 2012 15:41:48 +0700 |
parents | 5bafb912837e |
children |
line wrap: on
line source
#!/bin/sh if [ "$#" -lt 1 ]; then cat <<EOF Usage: $(basename -- "$0") EOF exit 1 fi if [ ! -r "$*" ] || [ -d "$*" ]; then cat <<EOF File "$*" can't be read! EOF exit 1 fi SERVER= while read LINE; do if [ -n "$(printf "%s" "${LINE}" | grep "^SERVER=")" ]; then SERVER=$(printf "%s" "${LINE}" | sed -e 's/SERVER=//') else [ -n "${SERVER}" ] && [ ! -z "$(printf "%s" "${LINE}" | grep -v "^$")" ] && moefetch fetch -s "${SERVER}" ${LINE} fi done < "$*"