I'm trying to create aliases for commands I'm typing a lot. Because I'm working on a big project built on Laravel I need to use the command line tool artisan fairly often. However, I don't often want to be in the root directory with that file.
I don't usually have to recurse upwards in scripts I've written, so I'm a little lost. My first thought is to attempt to use a command like
find . -name artisan and if it finds nothing, to
cd .. and check again until the current working directory is
/. Then I want to be able to pass arguments from the shell script to the final, found copy of artisan.
Is there a linux/unix/osx terminal utility/convention that would take care of this?
Sorry, I should have been clear about this before, but I didn't think about it.
artisan is a CLI interface to the Laravel PHP framework. I work in version 3, but if I start another project in it I will probably use version 4. Many breaking changes exist between these versions, but more importantly the
artisan script in the root of the project is just a bootstrap script to the code living within the framework.
EG, because it has local, version-sensitive dependencies to a
paths.php reference, which tells it where other resources are like the framework itself, I don't think I can move this to a
bin directory and symlink to it.
Yes I can symlink down to the script from sub-directories, but I was looking for something a bit more automatic than that. For instance, how does Git go about locating the repository directory from a subdirectory? I know it must recurse upward in the tree to locate it, but as its in C I am at a loss for how to find it, or implement it in Shell/Bash script.