On 8/28/06, Martin Bähr <[EMAIL PROTECTED]> wrote:
> hi,
>
> i am trying to use the function fish_title to set the title in screen.
>
> on the commandline i can change the title with:
> echo -ne '\033ksometitle\033\\'
>
> i figured that i should be able to do the same inside the function:
>
> function fish_title
>   echo -ne '\033ksometitle\033\\'
> end

function fish_title
  echo sometitle
end

should work.

>
> but that is not the case.
> instead sometitle gets written to the terminal itself.
>
> also, i expected that (commandline) should give me the last commandline:
>
> function fish_title
>   echo -ne '\033k'(commandline)'\033\\'
> end
>
> but it doesn't. what am i missing?

'commandline' will output the current contents of the commandline.
When you are starting a new program, the commandline will probably be
cleared. Maybe this is unintuitive? Might make sense to retain it
until after them command is executed. The way I saw it, I think, is
that the command has been sent to the evaluation function, so it's no
longer on the commandline. To get the name of the job currently being
executed, you can use the $_ variable.

>
>
> on a related note:
> why does
> echo -n "\eksometitle\e\\"
> not work in the commandline?

Because backslash escapes are disabled in quoted strings. This may
seem backwards, but it's not if you think about it. The role of quotes
in shells is to _disable_ most types of string transformations. Why
should backslash escapes be any different?

>
> in bash the following does work:
> echo -n "^[ksometitle2^[\\"
> (where ^[ is the literal escape)
>
> this suggests that \e is not equivalent to a literal escape or that fish
> generally handles escape in strings differently than bash.

Yes, escapes are handled very differently.

>
> greetings, martin.
> --
> cooperative communication with sTeam      -     caudium, pike, roxen and unix
> offering: programming, training and administration   -  anywhere in the world
> --
> pike programmer   travelling and working in europe             open-steam.org
> unix system-      bahai.or.at                        iaeste.(tuwien.ac|or).at
> administrator     (caudium|gotpike).org                          is.schon.org
> Martin Bähr       http://www.iaeste.or.at/~mbaehr/

-- 
Axel

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to