#!/bin/sh -u # # Run app-helper with the autoview mode on, defaulting to view-unknown. # - Cameron Simpson 17dec2002 # cmd=$0 unlink= trace= ahopts= while [ $# -gt 0 ] do case "$1" in -u) unlink=1 ;; -[nyNYAX]) ahopts="$ahopts $1" ;; *) break ;; esac shift done if [ $# = 0 ] then if [ -n "$DISPLAY" ] then set -- "`xclip -o`" || exit 1 else echo "Usage: $cmd file [command [args...]]" >&2 exit 2 fi fi file=$1; shift $trace apphelper "$file" -y $ahopts ${1+"$@"} || exit 1 # unlink old copy? [ $unlink ] || exit 0 [ -s "$file" ] || exit 0 loc=`fileloc "$file"` || exit 1 [ "x$loc" = "x$file" ] && exit 0 exec rm -- "$file"