I am trying to write a .bash script that takes 3 arguments and applies my sed script to the files found that where older than x days ago.
So for example my invocation is:
./program.bash <some_path> 2 -r
Inside my program I have
if [[$3 == -r]]; then
find $1 -mtime $2 -exec sed -rf my.sed {}/;
fi
However my -exec connection doesn't work. What am I doing wrong? is there any way to do this without using -f and putting the contents of my.sed directly on my bash program to be excuted?
[[$3 == -r]]should be[[ "$3" == "-r" ]]. Mind the spaces and quote the strings (or is it a typo?). – schrodingerscatcuriosity Sep 29 '20 at 01:53findcommand should be{} \;, backslash not slash. – schrodingerscatcuriosity Sep 29 '20 at 02:03