Vertical bar with rm

Closed
logan - Nov 8, 2009 at 08:04 PM
jipicy Posts 41342 Status Moderator - Nov 9, 2009 at 04:35 AM
Hello,

1. I want to remove everything except test dirctory, why the following command don't work:
ls |grep -v test |rm -fr

2. According to manual, vertical bar get current program result and add it into the last position of next command, how to make the result into mid of next command, is there any auto variable can use?

1 response

jipicy Posts 41342 Status Moderator 17
Nov 9, 2009 at 04:35 AM
Hi,

ls |grep -v test |xargs rm -fr