On Sun, Mar 20, 2011 at 11:06:32AM -0700, Chip Camden wrote:
> Here's a little script I use to move stdin to a file argument:
> 
> --------
> #!/bin/sh
> needsterm=false
> while getopts th o; do
>   case "$o" in
>   t)  needsterm=true;;
>   h)  echo >&2 "Usage: $0 [-t] cmd"
>       exit 1;;
>   esac
> done
> shift `expr $OPTIND - 1`
> file=`mktemp /tmp/farg.XXXXXX`
> cat > $file
> if $needsterm; then
>   `printf "$*" $file` < /dev/tty
> else
>   `printf "$*" $file`
> fi
> rm $file
> --------
> 
> I call it 'farg'.
> 
> Now you can use mutt's pipe command for any command that accepts a file
> argument:
> 
> |farg 'mplayer %s'
> 
> for commands that want stdin to be the terminal, add -t:
> 
> |farg -t 'vim %s'
> 
> -- 
> Sterling (Chip) Camden | sterl...@camdensoftware.com | 2048D/3A978E4F
> http://chipsquips.com  | http://camdensoftware.com   | http://chipstips.com

Thanks Chip, that worked!

Reply via email to