Operating System - Linux
1754021 Members
7958 Online
108811 Solutions
New Discussion

Re: How to verify correct directory before running command

 
SOLVED
Go to solution
Rasheed Tamton
Honored Contributor

Re: How to verify correct directory before running command

>so, instead of using the variable $PWD, I should jus hardcode the directory in the find command?

Yes. It is better - if you have few dirs in the script. In that case, you can use as Patrick said.


find $PWD -type f -mtime +30 -exec ls {} \+

find /home/mike -type f -mtime +30 -exec ls {} \+

replace ls with rm -i while you test the script.

rgds.