FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 01-03-2009, 08:08 PM
Curt Howland
 
Default Keystrokes go missing after script exits

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi.

I have a short script to convert my video camera's files into mpegs.
It works fine, and I canibalized the AviToVob script for the basic
structure and looping.

But it does one thing I cannot figure out: After the script completes,
my console doesn't show any keyboard output any more. I can type and
issue commands, and it all works, but nothing shows up of my typing
on the screen:

~
dierdre$ bash: ddd: command not found
~
dierdre$ bash: lll: command not found
~
dierdre$ bash: seewhatImean?: command not found

The script starts with "#!/bin/sh" and it never had this problem when
I run the original script, so I'm very much at a loss.

Any ideas?

Curt-

- --
The Magistrate, enrobed in taxes, condemns the thief in stolen rags.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iQEVAwUBSV/TvS9Y35yItIgBAQKE3wf+MYsLV1YLv7Vl2D8EF7g8MuN87xJXI FuG
9j+l+Oj4SBNpaH9KHf1KIIiZ3xbUu92jYXu7gziTD4aJHuDHBZ yr54uI9nzNUIVZ
kO5jzonuLPyDCxNGiQyJgev1y7K7U6x3fESD+1goOlTxM0cIxL H9rSDO6D0Z99Zn
NdI2jT917zpjt7hvcoR3YPvDIqP+RBNKyV8qFFg1e+y4baweXt IbB/xBsrGfp9RW
rkXKdSV6wfx1dXI3NE9u4Mqjq6un3izAzuvBw3FVVFKkHkqyua qRQAPgPoOOQBlc
jN8Lwk0MyUdVxt345Ur9iJJQCb1HK6BjylnJuiHmIwWCNG/09oCeug==
=I0fV
-----END PGP SIGNATURE-----


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-03-2009, 09:25 PM
"James Youngman"
 
Default Keystrokes go missing after script exits

It's left your terminal in a non-echoing mode; this is used for
example when asking for a password. You can fix this with "stty
sane".


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-03-2009, 10:31 PM
Curt Howland
 
Default Keystrokes go missing after script exits

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Saturday 03 January 2009, James Youngman was heard to say:
> It's left your terminal in a non-echoing mode; this is used for
> example when asking for a password. You can fix this with "stty
> sane".

Yes, I understand it's gone into non-echo mode. I just didn't know
that word for it.

Thanks for the after-fix, sure enough it worked.

Now, can I put that as the last command in my script and not have the
problem in the first place?

Curt-

- --
The Magistrate, enrobed in taxes, condemns the thief in stolen rags.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iQEVAwUBSV/1OC9Y35yItIgBAQKVGQf6Agk2m4JlACcDu2037MAhT/8rEQtA1ixx
FCzzcWNvWwlqYkWZncLaDl1k84p/3LS6680F+O6jOSUq458t14/XFfbRayjpQivu
sLxGtvdL9pEhFvXTdTcmiCotfHJvZC1FyoJDgw7G/zQNhUal4qQqWPnwloMf9FdS
YJmngDDDq6JuLBaYd3L0EA+OQScLWsfl8HfVU8JShPEa7vTINy 3fyK5zvNs3+a2U
jupKvE2UzverXrwehX/E2ZeEBdEt4vVhXH2lA1YWVB4ZkjXbud6G8namwd2YZRX9
0jKvQm54+lgfCh4LSlcqKKfmDXfyBY/cHUJhL4Qmb57A65T2LRjh/w==
=rafb
-----END PGP SIGNATURE-----


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-03-2009, 11:29 PM
"James Youngman"
 
Default Keystrokes go missing after script exits

On Sat, Jan 3, 2009 at 11:31 PM, Curt Howland <Howland@priss.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Saturday 03 January 2009, James Youngman was heard to say:
>> It's left your terminal in a non-echoing mode; this is used for
>> example when asking for a password. You can fix this with "stty
>> sane".
>
> Yes, I understand it's gone into non-echo mode. I just didn't know
> that word for it.
>
> Thanks for the after-fix, sure enough it worked.
>
> Now, can I put that as the last command in my script and not have the
> problem in the first place?

If it's the last command executed, yes. But the last command
executed may not the the final command in the script; it may exit
early.

There are three obvious ways to solve this problem.


1. Probably the most general solution: Rename the original script and
make a new wrapper script that calls it:

#! /bin/sh
# We save the old terminal mode with "stty -g" and restore it later.
# This is broadly similar to just calling "stty sane" but it copes better
# with cases like terminal setups where the 'erase' character isn't backspace.
orig_terminal_mode=$(stty -g)

# run the original script...
renamed-original-script
# ... and save its return value
rv=$?

# fix the terminal mode
stty $orig_terminal_mode

# exit with the same status as the original script did
exit $rv


2. Modify the original script: put "stty sane" at the end of the
script and before every "exit" command that doesn't appear in a
subshell. If there is a chance that the original script will need
other changes, this option imposes a maintenance burden on you.

3. Wrap the original script in ( ... ) and reset the terminal mode
once it's done. That is, edit the original script so that it looks
like the code from (1) but in place of "renamed-original-script" put
the entire text of the original script, inside parentheses ( ).
This approach has all the disadvantages of option (2) except that you
don't need to look for all the exit statements.



The reason these options are all apparently complex is that "stty
sane" will succeed (that is, exit with status 0) and so any non-zero
return value from the script would be masked if you just pasted in
"stty sane" at the end. If the script is trying to signal failure by
exiting with a non-zero status, masking that bu changing the status to
zero would potentially be damaging (i.e. the caller would not find out
that the script had in fact failed).

James.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 

Thread Tools




All times are GMT. The time now is 09:25 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org