I need to run an interactive program in the background so I can grep it for specific data to use for some logic in a script.
There is no quiet or background mode on the program so I plan to redirect a document with commands in it and then to grep the output.
This is almost working, except that then some lines I haven't grepped for are also appearing - this I don't understand - I thought grep would work on all output to STDOUT (I've tried redirecting STDERR too but that doesn't seem to help).
See example:
Notice two lines which strangely get written to the output
[Thr 01] Wed Jun 20 06:54:01 2012
[Thr 01] MtxInit: -2 0 0
How are these getting there?
I thought there were only two channels for output to screen in UNIX
STDOUT
and
STDERR
However if I running the main command (without the egrep) and redirect either STDOUT (1>) or STDERR (2>) to /dev/null - then the ONLY lines that show up are those two lines - this works identically no matter which output of those two I redirect....
[Thr 01] Wed Jun 20 06:54:01 2012
[Thr 01] MtxInit: -2 0 0
Weird - any thoughts?
---------- Post updated at 12:38 ---------- Previous update was at 12:00 ----------
NB An alternate fix for my issue would be to be able to call a command but with a time limit -- i.e. if this command returns no output within 5 seconds then kill it.... any ideas on this alt? If I can find a thread on that alternative I'll link it in here.
I have script, which need some variable from user and i use below command for this
read
this script works fine while running without background, but when i run this script in background, it ask first variable then immediately it show below error
KSH variable not found
please let me... (1 Reply)
Hi i need a c programm to login in unix(solaris).
non-interactivley because it seems difficult to do it with unix shell scripting and passwd command cant be used and also
i don't have expect installed and i am not allowed to installed expect in our servers.
is there any c programm that can help... (1 Reply)
Hi all,
I have a bit of a vexing issue here and I'm not certain how best to go about it. Basically, I want to run a shell script and automate the user prompt of hitting 1 to fully uninstall Symantec Anti-Virus for OS X.
Would expect be the best way to do this? (5 Replies)
Hello,
I'm looking to script the basic instant messaging program we have in my company, it's called "oi", it's working as follow:
# oi $user
then we have to launch it...
after finding the system of the user it's asking for the message...
then on a new line we have to hit ctrl+d
I... (2 Replies)
Hi,
I have a query about processing and running Perl program at the background.
I have HTML file called Userform.html which accepts input from the user. As soon as input is given the contol goes to get.cgi (get.cgi does some processing and computing tasks).
Actually get .cgi takes more... (0 Replies)
Hi I have created a program but am currently wondering how to develop it further. I wanted to know how i would go about developing the program further so that it is able to run with a "none interactive flag" enabling execution to be automated with the resultant file e-mailed to a user once a week.... (1 Reply)
Hi,
in my program i need to run an external program in background.I am aware that there are at least 2 alternatives for this:
1)fork+exec
2)system("program &");
I have read several posts about this,and they all tend to suggest to use fork+exec (and that's what i am doing now).
I have some... (2 Replies)
i am trying to find a way to put an interactive script in the background after taking input from the user
a few test lines i was trying:
date
echo "Enter location"
LOCATION=
read LOCATION
sleep 100
sleep 200
date
for this small example i want the script to as the user for the... (7 Replies)
now, i have a program that i would very much prefer to run remotely as i hate having to log into the box it is on.
the problem is, every command i have tried to run this remotely doesn't work.
the commands tries to kick off the program on the remote box but then hangs.
like take for... (3 Replies)
Hi Friends
I am trying to make an interactive shell script ( I do not have expect tool )
My objective is
1.I have a progam named say "inter"
The program when ran on command prompt will be as below
Prompt>inter
Please enter the choice
1.enter 1
2.enter 2
< I need to enter 1 or 2... (4 Replies)