473,382 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

about output redirection

hello!
I am currently writing my own script and need help on output redirection.as u know 'ls -al > myfile' would write the files in the current directory into the file called myfile.i know about opening a file and writing with fputc but have no idea about how to prevent the command from writing the output to terminal and get the output data to write to file..i hope i could tell my problem and someone could have an idea.
Nov 11 '07 #1
5 1635
numberwhun
3,509 Expert Mod 2GB
hello!
I am currently writing my own script and need help on output redirection.as u know 'ls -al > myfile' would write the files in the current directory into the file called myfile.i know about opening a file and writing with fputc but have no idea about how to prevent the command from writing the output to terminal and get the output data to write to file..i hope i could tell my problem and someone could have an idea.
First, I have deleted your duplicate post. Please do not double post your questions.

Second, I am not sure that I understand. Are you saying that you want the default output for your Terminal to be a file instead of the screen? If that is the case, how will you know what you are doing? If that is NOT what you want, then you will really have to better explain your question as it is rather confusing.

Regards,

Jeff
Nov 11 '07 #2
sorry about the duplicate post i tried to delete it but couldnt figure out how to do that.
i am trying to build a shell for my hw so if the user enters such a command "ls -al > myfile.txt" my shell should write the "ls -al" output into the myfile.txt instead writing to shell page..(just the same what bash shell does)
Nov 11 '07 #3
prevent the command from writing the output to terminal .
i am talking about the output of "ls -al "here..not all of the outputs we get from the shell
Nov 11 '07 #4
pbmods
5,821 Expert 4TB
Heya, zehrhand.

`ls -al > myfile.txt` doesn't do what you're expecting it to do?
Nov 11 '07 #5
yea but i want to write a function which does that job.i dont want to use built-in functions..if my shell uses system functions for all jobs,then whats the point of writing a shell?
Nov 12 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Bill Cohagan | last post by:
I'm writing a console app (in C#) and I want to be able to redirect the standard input/output streams when it's run at a command prompt. IOW I want to support the "<" and ">" redirection syntax....
1
by: Michael Shestero | last post by:
Hello. General description of my knotty problem: I have a code (a function f) on standart C++ that perform some smart action. This code works as console application getting user input from...
3
by: Liren Zhao | last post by:
I use some "Console.WriteLine(some strings here)" to display some debug information in my winform program. How can I get the information in my programe or same them in a text file ?
3
by: ES Kim | last post by:
Hi, I am using VC++ .NET 7.0. I'd like to debug my console program, using redirection of input/output for convenience. Help menu tells me it's possible to specify a file name as a command-line...
1
by: Karuna | last post by:
Hi, I am new to MySQL. I want to create a script file which will include a number of commands and execute it, just like we do in Oracle. Can any one tell me how to do it? Suppose I want to create...
1
by: btysgtmajor | last post by:
Hi all, I've searched high and low on this group and elsewhere and can't really seem to find an answer to this question. I'm running PHP4 on a Debian box with Apache. I'm trying to run the...
4
by: Barry | last post by:
Hi, guys Basiclly, it is automated testing system. There is a main python script that handles the testing campagin. This main script will call another script that will in turn runs a few...
2
by: prajil | last post by:
Hi, Could anyone point how can i override output redirection using perl. i.e. command > file 2>&1 will redirect both output and error of command to file I need to print a message to...
1
by: laredotornado | last post by:
Hi, I'm using PHP 5. Assuming there are no errors, how do I get the output of an exec call? I'm trying $cmd = 'strings < ' . escapeshellarg($file) . ' | sed - n \'s|.*/Count...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.