Redirect output as argument for other command(plz help)

Go down

Redirect output as argument for other command(plz help)

Post  goldberg on Tue Sep 16, 2008 4:52 am

How do we redirect output of one command as argument to another command
Actually i m searching for answer of question of tux wars
:
Suppose the root user wants to go into the home directory of user named "cs054011" what command will he execute at his shell. Assume he doesn't know the exact pathname of directory.
Now if I use the command
find . -name "cs054011" -print I will get the path of the user but how to redirect it as argument to cd

goldberg

Posts : 8
Join date : 2008-08-11

View user profile

Back to top Go down

Re: Redirect output as argument for other command(plz help)

Post  Admin on Tue Sep 16, 2008 5:45 am

you can use pipe to redirect input and output of one command to use each other ...........
ls|wc -l
in this command output of ls is taken as input og wc -l
just go through pipes for mor edetails...........
Very Happy

Admin
Admin

Posts : 39
Join date : 2008-08-03

View user profile http://computerclub09mnnit.forumotion.net

Back to top Go down

Re: Redirect output as argument for other command(plz help)

Post  goldberg on Tue Sep 16, 2008 12:49 pm

I don't want it to be input for the other command but as an argument for it.
find . -name "cs054011" -print [something] cd
This something should be such that the output of find . -name "cs054011" -print should be argument for cd

goldberg

Posts : 8
Join date : 2008-08-11

View user profile

Back to top Go down

Re: Redirect output as argument for other command(plz help)

Post  ankurgutpa on Wed Sep 17, 2008 4:53 pm

for ur question of TUX war just type the following command line sequence
Code:

$ su - cs054011
$ pwd
$ exit
after executing pwd root will get the absolute path for home directory of user cs054011 and then after exiting from his enviournment root can go to his home directory as a root itself cheers
avatar
ankurgutpa

Posts : 44
Join date : 2008-08-10
Age : 30
Location : Tandon 72

View user profile

Back to top Go down

Re: Redirect output as argument for other command(plz help)

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum