command execution
when a command is enterted how does it display the output on screen..... what is the internal working???
|
It displays as the command has determined. Some commands output nothing, others write and remove files and send a great deal to standard out. The devil's in the details of the command executed.
Dave |
Augmenting previous reply.....When working in a terminal, it is designated as the "standard output" (STDOUT). This can be redirected---to a file, to another terminal, etc.
|
The source code uses a "file descriptor" which is a sort of key to access a file. By convention, the first three file descriptors are reserved:
0 - standard input 1 - standard output 2 - standard error So a C code can send a message (for example using printf or fprintf) to file descriptor 1 (or 2) and it will be printed out in the console/terminal. In Fortran you have "unit numbers". Here, by convention: 0 - standard error 5 - standard input 6 - standard output |
You can redirect commandline output:
$ echo "my text" > newfile.txt will send output to the named file, and it works the other way around as well $ mysql mydatabase -umyusername -pmypassword < mydata.sql will send the contents of the sql file to the database Linux Archive |
Quote:
thanx for the answer, but my question is how does a ouput display on SCREEN...... |
Depends on the language, but ultimately it calls a library like curses, ncurses etc.
On Linux specifically, read up on QT, gtk |
Quote:
thanx for the answer, can u plz let me understand in detail......... |
Google those items I mentioned. Is this a generic homework qn or do you have a specific qn?
There are several levels involved in this qn and its not at all clear which one you want... |
Quote:
i simply want to know that when i typed $ echo hello hello was the output on the screen, plz tell me how does a ouput display on screen.......... i mean what is the internal working takes place? |
When you login *nix provides 3 std I/O channels automatically:
0 = stdin (standard input) 1 = stdout (standard output) 2 = stderr (standard error) If you type 'echo hello', it defaults to stdout (chan 1) As I said, there's more (many) levels underneath. If you tell us why you want to know, we can give you better answers. |
Quote:
WELL,i m doing a research for my office on echo command and i wanna know each and everything abt echo....... plz help me out.. 1. echo uses which libraries 2. how does echo work internally 3. what is the significance of escape sequences and who recognize that sequences in system.... and many more info abt echo... |
As this is Linux, you can read the source code; much faster than asking lots of qns.
Why do you care/need to know the internals? What are you trying to achieve? |
Quote:
i hv to learn the internals..... how can i get the sorce code of a command.. can u plz gv me some useful links... |
Quote:
Code:
ldd `which echo` 3. same as point 2. |
All times are GMT -5. The time now is 07:27 PM. |