i have this alias that works on "/" directory but stops working when path changes
alias exesh='chmod +x $(find . -maxdepth 1 -name '*.sh')'
I am a newbie with Unix so any help is welcome
*I'm using cygwin, if can be this the issue *
Bash, on this problem, says me this
find: paths must precede expression: 2b.sh
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
chmod: missing operand after '+x'
Try 'chmod --help' for more information.
but if i paste on command line chmod +x $(find . -maxdepth 1 -name '*.sh')
it works properly, so i think it depends on current directory .
with suggestion on using find -exec i finally my problem solved. The solution is:
alias exesh='find . -name "*.sh" -exec /bin/chmod +x {} \;'