Hi Thomas,

In fish 2.1.1, it behaves the way you describe, but in trunk $history[1] will 
include the last command from fish_prompt.

This was fixed as https://github.com/fish-shell/fish-shell/issues/984 
<https://github.com/fish-shell/fish-shell/issues/984>

I don't know how to implement this easily in fish 2.1.1, sorry.

Hope that helps,
_fish

> On Oct 26, 2014, at 6:20 AM, V10lator <v10la...@myway.de> wrote:
> 
> Hi,
> As I'm running commands which take a long time to execute I would love to 
> be notified when the command finished. For that i added this code to my 
> fish_prompt:
> 
>       set -l last_status $status
> 
>       if set -q CMD_DURATION
>               if not set -q DISPLAY
>                       wall "fish: Job $history[1] returned $last_status, took 
> $CMD_DURATION"
>               else
>                       notify-send -a "fish" "$history[1]" "Returned 
> $last_status, took 
> $CMD_DURATION"
>               end
>       end
> 
> But $history[1] accesses the command before the one that just exited.
> 
> Long story short: I'm searching a way to get the last entered command from 
> within fish_prompt.
> 
> Thanks for reading,
> Thomas
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Fish-users mailing list
> Fish-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/fish-users

------------------------------------------------------------------------------
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to