Execute a script and not able to redirect to a file
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The script's function is to execute abc.out. To simplify, abc.out has a bunch of questions and the user has to answer it.
Contents of the script:
pidof abc.out | xargs kill (find the pid and kill the process) /programs/abc.out
The function of abc.out is:
abc.out asks the user many questions and the user replies to it.
abc.out waits for the inputs from the user.
If the script is to execute many commands without any user interaction the redirection to the file works but if its the case like above, the redirected file is empty.
Thanks!
P.S: Since I use Busybox, and there is no pidof, I somehow managed to do the equivalent of pid.
Thanks for your input. But abc.out does a lot more than just simple questions. It communicates between another console where it gets the input. So this has to be run by another script. And when I run this script I need to capture all the input/output from abc.out to a log file. Hence my question.
Or it doesn't create an output at all. Perhaps the application only creates an output on virtual terminals just for the sake of interaction. It doesn't open anything like files if it's not.
Or it doesn't create an output at all. Perhaps the application only creates an output on virtual terminals just for the sake of interaction. It doesn't open anything like files if it's not.
But I can see a lot of information coming up in my console.
No I just wanted atleast the script to run while having the ">>" in my command. But I don't want it to run in the background.
Also, my task can also be implemented if I could capture everything that is going to happen right from logging into the console. Is there anyway to capture everything from log on. I will be continuously monitoring the log so that once I find a regex match I will have to run the script again. That has been my aim.
But I can see a lot of information coming up in my console.
Try running vim > out.txt. You'll notice that it would send a message like "Vim: Warning: Output is not to a terminal. This shows that an application could detect what its output device is like. Perhaps your application abc.out doesn't open any output at all if it's not a terminal. Could you examine the application directly, I mean examine its source code?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.