Redirect output as argument for other command(plz help)
Page 1 of 1 • Share •
Redirect output as argument for other command(plz help)
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
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
Re: Redirect output as argument for other command(plz help)
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...........

ls|wc -l
in this command output of ls is taken as input og wc -l
just go through pipes for mor edetails...........
Admin- Admin
- Posts: 39
Join date: 2008-08-03

Re: Redirect output as argument for other command(plz help)
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
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
Re: Redirect output as argument for other command(plz help)
for ur question of TUX war just type the following command line sequence
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
- 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

ankurgutpa- Posts: 44
Join date: 2008-08-10
Age: 22
Location: Tandon 72
Permissions of this forum:
You cannot reply to topics in this forum



