Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Execution upon directory entrance?

Avatar of ramble
rambleFlag for United States of America asked on
Unix OS
17 Comments1 Solution381 ViewsLast Modified:
Just curious

If this is not possible, you'll still receive full credit saying "not possible"

But I was wondering if unix can automatically execute a script, (shell script or perl), upon entering a directory.

For example, lets say:

/usr/bin contains a script called "file_filter.sh".

Now, lets just say that "file_filter.sh" just contains a command like: ls -lart | grep -i ramble

So, we do this:

# pwd
# cd temp
# cd website
# cd Ramble
-rwx------   1 ramble    user       2166 Mar 19 11:21 index.html
-rw-------   1 ramble    user        877 Mar 19 11:21 something.cgi
drwx------   6 ramble    user        512 Mar 25 09:01 ..
-rwx------   1 ramble    user        852 Mar 26 11:22 README
drwxr-xr-x   2 ramble    user        512 Mar 26 14:38 .

So, upon entering the Ramble directory, the file_filter.sh script was executed, and displayed.

Avatar of ahoffmann
ahoffmannFlag of Germany image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 17 Comments.
See Answers