|
Home > Archive > Unix Shell > December 2006 > Clipping 21x40 console window
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Clipping 21x40 console window
|
|
| Hufnus 2006-12-15, 1:34 am |
| This sample script can set the window fine for me, but
I need to add line clipping so that output does not wrap
around...
#!/bin/sh
#
# Set 40x21 window
LINES=21 export LINES
stty rows 21
stty cols 40
tput csr 0 20; tput clear; tput cup 20 0
ps -we fx --header | more
sleep 10
# Reset screen
LINES=25 export LINES
stty rows 25
stty cols 80
tput csr 0 24; tput clear; tput cup 24 0
thanks, TonyB
There are 10 types of people in this world, those that read
binary and those who don't!
--
__ __ _ I N C. http://www.sysdev.org
/ __|\\// __|| \ __ __ / tonyb@sysdev.org
\__ \ \/\__ \||)|/ O_)\/ / \/ System Tools / Utilities
|___/ || ___/|_ /\___|\_/ WIntel / Linux Device Drivers
| |
| Hufnus 2006-12-15, 1:34 am |
| On Thu, 14 Dec 2006 21:53:42 -0800
Hufnus <tonyb@sysdev.org> wrote:
> This sample script can set the window fine for me, but
> I need to add line clipping so that output does not wrap
> around...
>
Ups, forgot to state that the window will just run a shell
and not a specific command, which would be easier to clip &
truncate to a 40chr width...
TonyB
--
__ __ _ I N C. http://www.sysdev.org
/ __|\\// __|| \ __ __ / tonyb@sysdev.org
\__ \ \/\__ \||)|/ O_)\/ / \/ System Tools / Utilities
|___/ || ___/|_ /\___|\_/ WIntel / Linux Device Drivers
| |
| johngnub 2006-12-15, 7:25 pm |
| If I under stand...IE cut it off, and discard the over hang, This may
look silly, but...
example: cut the chars off with cut,
echo "12345678901234567890" | cut -c1-10
1234567890
In your example ps -we fx --header |cut -c 1-21
Worked in bash/linux.
2 cents ...
Hufnus wrote:
> This sample script can set the window fine for me, but
> I need to add line clipping so that output does not wrap
> around...
>
> #!/bin/sh
> #
> # Set 40x21 window
> LINES=21 export LINES
> stty rows 21
> stty cols 40
> tput csr 0 20; tput clear; tput cup 20 0
>
> ps -we fx --header | more
> sleep 10
>
> # Reset screen
> LINES=25 export LINES
> stty rows 25
> stty cols 80
> tput csr 0 24; tput clear; tput cup 24 0
>
> thanks, TonyB
>
>
> There are 10 types of people in this world, those that read
> binary and those who don't!
>
> --
> __ __ _ I N C. http://www.sysdev.org
> / __|\\// __|| \ __ __ / tonyb@sysdev.org
> \__ \ \/\__ \||)|/ O_)\/ / \/ System Tools / Utilities
> |___/ || ___/|_ /\___|\_/ WIntel / Linux Device Drivers
| |
| Hufnus 2006-12-15, 7:25 pm |
| On 15 Dec 2006 12:18:45 -0800
"johngnub" <johngnub@COX.NET> wrote:
> If I under stand...IE cut it off, and discard the over hang,
> This may look silly, but...
> example: cut the chars off with cut,
> echo "12345678901234567890" | cut -c1-10
> 1234567890
>
> In your example ps -we fx --header |cut -c 1-21
> Worked in bash/linux.
Well it sort of works, remember this is to bind a shell
into a 21x40 window, so the command is really
bash | cut -c 1-21
results in no bash prompt, but the shell responds and for
example a 'cat file.txt' is bound to the screen limits.
Now, how do I get the bash prompt back?
Also and accidental ctrl-C, kills the hole thing!
TonyB
--
__ __ _ I N C. http://www.sysdev.org
/ __|\\// __|| \ __ __ / tonyb@sysdev.org
\__ \ \/\__ \||)|/ O_)\/ / \/ System Tools / Utilities
|___/ || ___/|_ /\___|\_/ WIntel / Linux Device Drivers
| |
| Random832 2006-12-15, 7:25 pm |
| 2006-12-15 <20061215132130.50a238ae.tonyb@sysdev.org>,
Hufnus wrote:
> On 15 Dec 2006 12:18:45 -0800
> "johngnub" <johngnub@COX.NET> wrote:
>
>
> Well it sort of works, remember this is to bind a shell
> into a 21x40 window, so the command is really
>
> bash | cut -c 1-21
>
> results in no bash prompt, but the shell responds and for
> example a 'cat file.txt' is bound to the screen limits.
>
> Now, how do I get the bash prompt back?
> Also and accidental ctrl-C, kills the hole thing!
Go into bash, without any fancy pipes
type this:
exec > >(cut -c 1-21)
|
|
|
|
|