bug-bash
[Top][All Lists]
Advanced

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

corrupted input after size function (input that's not recorded by bash)


From: Linda Walsh
Subject: corrupted input after size function (input that's not recorded by bash)
Date: Thu, 13 Jun 2013 12:58:02 -0700
User-agent: Thunderbird


I have a small function in my bashrc:

function showsize () {\
  local s=$(stty size); local o="(${s% *}x${s#* })"; s="${#o}";\
  echo -n $o; while ((s-- > 0));do echo -ne "\b"; done; \
}
export -f showsize
trap showsize SIGWINCH
---
That has the effect of showing me my current window size
when I resize it.

The odd thing is, if I use it while at a bash input prompt --
any command I type has the first word ignored.

so if I type:
echo cmd

If 'cmd' is not a typo you can use command-not-found to lookup the package that contains it, like this:
    cnf cmd
---
But then I re-edit the line (in vi-mode, ESC-k, it shows me I typed
echo cmd -- and, indeed, if I hit return, it echo's the word 'cmd' w/no error.

So how can my showsize function be mangling the input in a way that
prevents proper execution, but isn't recorded by bash?

(this has been one of those things that's bothered me for years, but
never been important enough to even ask about... I thought I'd look at it
to fix it, but still don't see why it does what it does).

Any clues?





reply via email to

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