05-19-2009
Wierd behaviour setting stty echo
Hi all,
Encountered a wierd behaviour which I am unable to understand.
I have a function doing the follow:
function RETRIEVE_PASSWORD
{
if (( $DC_ACCOUNT ))
then
clear
printf "\nEnter Password for ${ConfiguredUser}"
printf "\nPassword: "
stty -echo
read -r DCAcctPwdPart1
fi
}
Problem is that, when I call this function from the main program, it works fine. But when I call it from within another function, it breaks giving me the error:
unable to set stty
It doesn't wait for user input...
Read some information regarding the interactive mode, I planted echo $- in different part of the code, but all returned "h"
What am I missing here. Thanks for any input and opinion.
Regards
Eugene
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I am getting this message when I run my script.
$ runscript.sh
Not connected to any service!
Here is the beginning of the script:
# 1 - failure
#
# variable declaration
FILEDATE=`date +"%Y%m%d"`
Not connected to any service!
Right after the FILEDATE gets loaded I get that... (6 Replies)
Discussion started by: lesstjm
6 Replies
2. Programming
I have encountered a strange problem dealing with pipes
and forking. The program basicaly does this:
cat file | tbl | eqn | groff
Now, I have a parent process that forks children
that that exec the stuff that they should. The pipes defined
in the parent are the ones used.
The chain goes... (1 Reply)
Discussion started by: denoir
1 Replies
3. Solaris
Hi!
I own a sparc 5 and i seem to have a strange problem. When its off, it starts by itself...
Sounds a bit strange? Iknow. Does anyone know whats causing this?? Could it be the network card? or is it someting in ENV or some other configuration??
//dOzY (5 Replies)
Discussion started by: dozy
5 Replies
4. UNIX for Dummies Questions & Answers
I have Debian Etch release as a fresh install on a PIII to be a router/firewall. I've configured networking, and utilized Shorewall to set up iptables scripting. I've installed dhcp3, both client and server, to pull an ip from my broadband cable modem, and dish out ip's to a switch for other... (2 Replies)
Discussion started by: pflink
2 Replies
5. Programming
Hi,
Please see this:
When i make a declaration as:
char *i, j, *k;
and then do
sprintf( k, "print.sh %s", i );
the program works fine.
But when i change the declaration to:
char *i, *k;
and then do
sprintf( k, "print.sh %s", i );
I get a segmentation fault at the 'sprintf'... (16 Replies)
Discussion started by: karthikb23
16 Replies
6. Shell Programming and Scripting
Hello All,
I need to set the width or number of columns for my dynamic output in the echo statement.
statement is like:
echo " <output> "
here the <output> is dyamice and can be of any number of characters, the " " should always start in same column everytime it is... (4 Replies)
Discussion started by: s123.radha
4 Replies
7. Shell Programming and Scripting
Hi
How to set the ECHO off in shell scripts so that the default output will be hidden. (2 Replies)
Discussion started by: Joseph Antoine
2 Replies
8. AIX
Hi,
I have a bunch of AIX systems which usually have more than enough memory to live happily. Unfortunately we have on a few of our boxes an rman runaway problem - every now and than after restoring from rman backups, the process goes crazy and eats all memory it could possibly get hold off -... (0 Replies)
Discussion started by: zxmaus
0 Replies
9. UNIX for Dummies Questions & Answers
I am wondering about the following:
stty columns 140
I have found that a number of times I need to set my display columns to a high number (such as 140) but I have to do this every time I login to use putty/ssh. Can we set this with an environmental variable so that it is permanent?
Also... (4 Replies)
Discussion started by: newbie2010
4 Replies
10. UNIX for Beginners Questions & Answers
version info : Fedora 28 (Kernel version: 4.16.12-300)
shell : bash
Using echo command , if I redirect a text like "Chocolate" to a file , all the contents in the file are overwritten as shown below.
# cat /tmp/someTest
Hello world
One more Hello world
myLine3
# echo... (4 Replies)
Discussion started by: kraljic
4 Replies
STTY(3) BSD Library Functions Manual STTY(3)
NAME
stty, gtty -- set and get terminal state (defunct)
LIBRARY
Compatibility Library (libcompat, -lcompat)
SYNOPSIS
#include <sgtty.h>
stty(int fd, struct sgttyb *buf);
gtty(int fd, struct sgttyb *buf);
DESCRIPTION
These interfaces are obsoleted by ioctl(2). They are available from the compatibility library, libcompat.
The stty() function sets the state of the terminal associated with fd. The gtty() function retrieves the state of the terminal associated
with fd. To set the state of a terminal the call must have write permission.
The stty() call is actually 'ioctl(fd, TIOCSETP, buf)', while the gtty() call is 'ioctl(fd, TIOCGETP, buf)'. See ioctl(2) and tty(4) for an
explanation.
DIAGNOSTICS
If the call is successful 0 is returned, otherwise -1 is returned and the global variable errno contains the reason for the failure.
SEE ALSO
ioctl(2), tty(4)
HISTORY
The stty() and gtty() functions appeared in 4.2BSD.
BSD
June 4, 1993 BSD