Not able to see the inputted command on the shell prompt..but its executing the comnd


 
Thread Tools Search this Thread
Top Forums Programming Not able to see the inputted command on the shell prompt..but its executing the comnd
# 1  
Old 09-19-2006
Not able to see the inputted command on the shell prompt..but its executing the comnd

Hi ,
I m writing a program which involves piping(pipes).

In my program, once i execute the child process (dealing with pipe),I m not able to see any inputted command on the screen....but the entered command is getting executed...

Actaully inorder to implement piping i hav closed STDIN and STDOUT in the child but according to me it should only last for child process,once execvp() is executed in the child process everthng shuold be restored...rite!!!

Inspite of this, i tried to flush everythng once the child processs terminate.

Still i m not able to see the inputted command.. Smilie


Pls reply fast its bit urgent
# 2  
Old 09-19-2006
I thnk you mean fork(). execvp() does not return, the parent is replaced by the child.
# 3  
Old 09-19-2006
nopes man!!!

control goes to parent process (after execvp() in the child process)...but in parent process when i m trying to input anythng ...its not getting displyed on the STDOUT but that command is getting executed.

for example

myshel$ ls|more
a.h
b.h
c.c
d.d so on....

myshel$ clear

Here, after child executes ls|more , the reuslt is displayed on the output screen but thereafter i m not able to see whatever i type on the shell...for exampl here i m not able to see clear command(its in bold)...but its executing the clear command Smilie
# 4  
Old 09-20-2006
Maybe I don't understand what you're doing, but exec function do clobber the calling process - from the man page:

Code:
SYNOPSIS 
#include <unistd.h> 
extern char **environ; 

int execl(const char *path, const char *arg, ...); 
int execlp(const char *file, const char *arg, ...); 
int execle(const char *path, const char *arg , ..., char * const envp[]); 
int execv(const char *path, char *const argv[]); 
int execvp(const char *file, char *const argv[]); 

DESCRIPTION 
The exec() family of functions replaces the current process image with a new process image. 
The functions described in this manual page are front-ends for the function execve(2). 
(See the manual page for execve() for detailed information about the replacement of the current process.)

Post your code
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Shell script not working but command works in command prompt

Hi everyone I have a problem with my script If I try directly this command /usr/bin/nice -n 19 mysqldump -u root --password="******" wiki_schneider -c | nice -n 19 gzip -9 > /point_de_montage/$(date '+%Y%m%d')-wiki-db.sql.gz It works But if I simply add this command in a script and... (8 Replies)
Discussion started by: picemma
8 Replies

2. Shell Programming and Scripting

Executing 'exit' command from shell script

Hi, I am writing shell script to automate few use cases for CLI interface. We have CLI interface which has bunch of commands. I am trying to execute one of the commands 'exit' as part of automation to exit from CLI object (not from shell script) in my shell script. My intension is to execute... (4 Replies)
Discussion started by: Mahesh Desai
4 Replies

3. Shell Programming and Scripting

Use Unix shell script to open Windows command prompt (cmd)

Hello, I work on Windows and I use Putty to access a remote UNIX server. I am trying to build a shell script that will have as main task to open the Windows command prompt (cmd) and run some Windows commands thereafter. The commands are actually file transfer commands that will download a file... (14 Replies)
Discussion started by: rookie2785
14 Replies

4. Shell Programming and Scripting

MKS KORN SHELL WONT EXECUTE from windows command prompt

Can anybody help me with this small script , the script works fine and launches the IE from c:\documents and settings \test\my documents>ksh prompt $RunURL1.sh this scitpt works and launches the ie from ksh , but when i schedule it to run the script then i get the error box saying command:1... (2 Replies)
Discussion started by: venu
2 Replies

5. UNIX for Advanced & Expert Users

executing a command on parent shell

Hi, I am logging in from my PC terminal to a linux host using ssh. Is it possible to execute a command on the parent PC terminal from the linux host during login. NOte that the parent PC does not have sshd running. Sam (1 Reply)
Discussion started by: sardare
1 Replies

6. UNIX for Dummies Questions & Answers

running command prompt executable file in shell script

hi i have file extentioned with test.vbs. i am able to run this file n execute through command promt but i dont know how to run in shell script example: file name is test.vbs which contains strSoundFile = "C:\windows\Media\Notify.wav" Set objShell = CreateObject("Wscript.Shell") strCommand... (5 Replies)
Discussion started by: atl@mav
5 Replies

7. Shell Programming and Scripting

Substituting a user Inputted word into a command

I am creating a menu driven system and i want to show the last login times of different users, instead of using the 'last' command i wanted to know if there is anyway i could make a brief search tool where the user can input which user they are looking for and then the login times for that specific... (2 Replies)
Discussion started by: warlock129
2 Replies

8. UNIX for Dummies Questions & Answers

SED command is not executing within the shell

Hallo everybody I am having a shell script called auto_run.sh in that only the first line works. the second line which has sed command is working only at the # prompt. not within the shell script. Your help is highly appreciated.Thank you in advance. exec auto_inv.4ge >KTI sed 's/ //g'... (1 Reply)
Discussion started by: naushad
1 Replies

9. Shell Programming and Scripting

How to hide user inputted text for interactive unix shell script?

Hi everybody, Do you know how to hide the text for interactive unix shell script? Just like the case for inputting password during logon. Patrick (1 Reply)
Discussion started by: patrickpang
1 Replies

10. Shell Programming and Scripting

Move command in the shell isnt executing...

-----------------------------------------------------------------------------Pls find my Q in the bottom--------------------------------------------- #!/bin/ksh #+---------------------------------------------- #| #| Usage: . scripts/run_all.ksh < scripts/run_all.txt #| #| This script... (2 Replies)
Discussion started by: thumsup9
2 Replies
Login or Register to Ask a Question