r() {
- exit "$@"
+ exit "$@" 2>/dev/null
+}
+
+# trash-restore lists everything that has been trashed at or below CWD
+# This picks out files just in CWD, not subdirectories,
+# which also match grep $1, usually use $1 for a time string
+# which you get from running restore-trash once first
+pick-trash() {
+ local name x ask
+ local nth=1
+ # last condition is to not ask again for ones we skipped
+ while name="$( echo | restore-trash | gr "$PWD/[^/]\+$" | gr "$1" )" \
+ && [[ $name ]] && (( $(wc -l <<<"$name") >= nth )); do
+ name="$(echo "$name" | head -n $nth | tail -n 1 )"
+ read -p "$name [Y/n] " ask
+ if [[ ! $ask || $ask == [Yy] ]]; then
+ x=$( echo "$name" | gr -o "^\s*[0-9]*" )
+ echo $x | restore-trash > /dev/null
+ elif [[ $ask == [Nn] ]]; then
+ nth=$((nth+1))
+ else
+ return
+ fi
+ done
}
# rsync, root is required to keep permissions right.
ps_char='\$'
;;
1) ps_color="$(get_term_color green)"
- ps_char=$return
+ ps_char="$return \\$"
;;
*) ps_color="$(get_term_color yellow)"
- ps_char=$return
+ ps_char="$return \\$"
;;
esac
if [[ ! -O . ]]; then # not owner