Take the 2-minute tour ×

I have this command :

for i in $(svn st | grep \! | awk '{print $2}'); do svn delete $i; done

I would like to execute it to a subfolder without making a cd command. Is it possible ?

Thanks !

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Not sure if this counts. If the problem is just that you don't want to use a cd because you don't want to have cd back, you can use a subshell using the ( ... ) notation. You can change directory inside the parens but it's discarded when you exit. Try this and you'll see instantly what it does:

( cd ..; pwd); pwd

If you're really insistent you don't want to see the cd command anywhere in the loop, you could use a procedure as a wrapper to hide it.

share|improve this answer
Thanks I'll choose between use cd or use your solution –  Pierre Dec 5 '12 at 22:45
add comment

Your Answer


