Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.