LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Can't run "cd" with xargs (https://www.linuxquestions.org/questions/linux-newbie-8/cant-run-cd-with-xargs-727804/)

rwalsh26 05-22-2009 09:05 AM

Can't run "cd" with xargs
 
I'm trying to use xargs within a script as follows and I'm not sure why the command is failing:
rwalsh05@linux-tax7:/usr/lib> ls|grep -E '^python2.'|xargs -t cd
cd python2.5
xargs: cd: No such file or directory
The point is to cd to /usr/lib/python2.5 from /usr/lib. I'm using ls with xargs to pick out the correct directory to change to since /usr/lib contains "python" and "python2.5"

JulianTosh 05-22-2009 09:25 AM

Code:

cd `ls|grep -E '^python2.'`


All times are GMT -5. The time now is 11:37 PM.