[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Random idea:



On Wed, Dec 29, 1999 at 05:40:04PM -0800, Mark Lundeberg wrote:
> Using #! wouldn't be a very good solution. You could solve the path
> problem and make it user-configurable hacking the #! header interpreter to
> take something like '#!text-editor' or '#!gz-uncompress', so it could be
> user-configurable (User A sets text-editor to vi, User B sets it to
> emacs). However, this only allows one action per user to be taken upon
> exectution of the file.

Debian already provides (for instance) /usr/bin/sensible-editor:

#!/bin/bash
shopt -s execfail
exec ${VISUAL:-${EDITOR:-editor}} "$@"
exec ae "$@"
exec vi "$@"
echo "Couldn't find an editor!" 1>&2
echo "Set the \$EDITOR environment variable to your desired editor." 1>&2
exit 1

I don't think this approach is terribly handy at the command line---what I'd
prefer is something like "view <file>", "edit <file>"... lesspipe already
does most of what I'd want from "view".

-- 

Adam Sampson
azz@gnu.org


Reply to: