Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: trap signal with functional scope?



Sebastian Stark wrote:
> 
> I have the following zsh function:
> 
> ssh () {
>          set_screen_title ${*##-*}
>          command ssh "$@"
>          set_screen_title "${HOST/.*}"
> }
> 
> Most of the time this just works and is cool. It fails when I send  
> ctrl-c to the ssh process.

With a suitably recent version of zsh (4.3.something), the fix is

ssh () {
  set_screen_title ${*##-*}
  {
    command ssh "$@"
  } always {
    set_screen_title "${HOST/.*}"
  }
}

Without a suitably recent version of zsh, the answer is probably to
upgrade.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



Messages sorted by: Reverse Date, Date, Thread, Author