rturrado
rturrado

Reputation: 8074

ksh alias or function that does "setTermName blah"

I have the following line:

echo -ne "\033]0;blah\007"

that correctly sets the term name to blah. But if I place that line within a function, as in:

setTermName()
{
  echo -ne "\033]0;blah\007"
}

it doesn't work anymore. I guess escape sequences are not treated correctly within the function. So my question could be reformulated as: How do you use escape sequences within a function?

I only want to be able to do setTermName foo from command line.

Upvotes: 0

Views: 249

Answers (1)

user332325
user332325

Reputation:

You invoke that echo command from interactive ksh also? Are you sure it understands -ne? It's not standard. Maybe use printf.

And you can try to use alias instead.

UPD: I've checked with AIX ksh, the following function worked:

set_tn()
{
  printf "\033]0;$1\007"
}

Upvotes: 1

Related Questions