may be it seems strange for you, but I want to run command in a specific folder without changing the current folder in the shell. Example - this is what I usually do:
~$ cd .folder
~/.folder$ command --key
~/.folder$ cd ..
~$ another_command --key
Though I want something like this:
~$ .folder command --key
~$ another_command --key
Is it possible?
If you want to avoid the second
cd
you can useWithout
cd
... Not even once. I found two ways:and second:
I had a need to do this in a bash-free way, and was surprised there's no utility (similar to
env(1)
orsudo(1)
which runs a command in a modified working directory. So, I wrote a simple C program that does it:The usage is like this:
A simple bash function for running a command in specific directory:
Usage: