help-nano
[Top][All Lists]
Advanced

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

Re: [Help-nano] Post Exit Hook?


From: higuita
Subject: Re: [Help-nano] Post Exit Hook?
Date: Sat, 10 Jan 2009 01:49:16 +0000

Hi

On Mon, 06 Oct 2008 11:49:40 +0100, Ashley Hindle <address@hidden> wrote:
> Is it possible to setup a post exit hook?
> I would like to run "php -l $filename" after exiting from nano.

        put this in your ~/.bashrc

        nanop() { nano "$1" && php -l "$1" ; }

        then when you write "nanop file" it will edit the file and if 
nano exits without any problem it will execute the php.

        i recommend not using the nano as the function name, as this
way you can choose to edit a file or to edit+execute a file.

        you can also replace $1 to $* to pass all command line arguments
to one or both commands, but be sure that it do what you want

good luck
higuita
-- 
Naturally the common people don't want war... but after all it is the
leaders of a country who determine the policy, and it is always a 
simple matter to drag the people along, whether it is a democracy, or
a fascist dictatorship, or a parliament, or a communist dictatorship.
Voice or no voice, the people can always be brought to the bidding of
the leaders. That is easy. All you have to do is tell them they are 
being attacked, and denounce the pacifists for lack of patriotism and
exposing the country to danger.  It works the same in every country.
           -- Hermann Goering, Nazi and war criminal, 1883-1946

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]