Home » Infrastructure » Unix » shell scripting
shell scripting [message #181852] Tue, 11 July 2006 23:14 Go to next message
703009827
Messages: 10
Registered: June 2006
Junior Member
HI

I getting the following error in /etc/profile.If I am running from unix server login as oracle its running fine if I am executing through the shell scripting i am getting follwoing error

ttytype: couldn't open /dev/tty for reading
stty: : Not a typewriter
You have mail.
Not a terminal
stty: : Not a typewriter
stty: : Not a typewriter
stty: : Not a typewriter
^[2 ^[2 ^[2 ^[2 ^[2 ^[2 ^[2 ^[2 ^[2 ^[2 ^[2 ^[2 ^[2 ^[2 ^[
2 ^[2 ^[2 ^[2 ^[2 ^[2



The following code I added in the /etc/profile
# Be sure that VUE does not invoke tty commands

if [ ! "$VUE" ]; then

# set term if it's not set

if [ "$TERM" = "" -o "$TERM" = "unknown" -o "$TERM" = "dialup" \
-o "$TERM" = "network" ]
then
eval `ttytype -s -a`
fi

export TERM

# set erase to ^H, if ERASE is not set
if [ "$ERASE" = "" ]
then
ERASE="^H"
export ERASE
fi
stty erase $ERASE
fi #VUE IF

Its HP-UX B.11.00 U 9000/800 server

Please help me what could be the reason for getting above error
I have uploaded the debug script while executing the profile file.


Thanks,Siva
  • Attachment: profile.txt
    (Size: 3.56KB, Downloaded 1573 times)
Re: shell scripting [message #181901 is a reply to message #181852] Wed, 12 July 2006 02:31 Go to previous messageGo to next message
rleishman
Messages: 3728
Registered: October 2005
Location: Melbourne, Australia
Senior Member
Some commands return an error for a background shell. In almost every case, we only ever want these commands to run when we are in an interactive shell.

Use the tty command to stop a command from running in a non-interactive shell:
tty > /dev/null && {
 ... place interactive shell commands here ...
}


Ross Leishman
Re: shell scripting [message #181911 is a reply to message #181901] Wed, 12 July 2006 03:16 Go to previous messageGo to next message
703009827
Messages: 10
Registered: June 2006
Junior Member
Thanks for quick response.

u mean to give like below in /etc/profile file

if [ ! "$VUE" ]; then

# set term if it's not set

if [ "$TERM" = "" -o "$TERM" = "unknown" -o "$TERM" = "dialup" \
-o "$TERM" = "network" ]
then

tty > /dev/null && {
eval `ttytype -s -a`
}

fi

export TERM

# set erase to ^H, if ERASE is not set
if [ "$ERASE" = "" ]
then
ERASE="^H"
export ERASE
fi
tty > /dev/null && {
stty erase $ERASE
}

fi #VUE IF

Regards,Siva
Re: shell scripting [message #182081 is a reply to message #181911] Wed, 12 July 2006 22:24 Go to previous messageGo to next message
rleishman
Messages: 3728
Registered: October 2005
Location: Melbourne, Australia
Senior Member
Try it. Does it work?
Re: shell scripting [message #182233 is a reply to message #181852] Thu, 13 July 2006 21:34 Go to previous message
703009827
Messages: 10
Registered: June 2006
Junior Member
Hi Its Working

Thanks for timely help
Previous Topic: how to Create File
Next Topic: Font end
Goto Forum:
  


Current Time: Sat Apr 20 09:04:41 CDT 2024