linux - Putting a find command as an alias -
I am trying to create an alias for the following command which changes the permissions of all the files in the current file to 644 continuously , And the second which converts all directories to 755.
alias fixpermissions = 'cd ~ / public_html / wp-content / themes / presstheme; Find-type f -exec chmod 644 {} \; Find-type d -exec chmod 755 {} \; However, when I run it, I get: Find: path must be before expression These commands work themselves well in Shell
Thank you !!
You need an extra semi-colon to set your nickname: alias fixpermissions = 'cd ~ / public_html / wp-content / themes / presstheme; Find-type f -exec chmod 644 {} \; ; Find-type d -exec chmod 755 {} \; ; CD ' You may benefit from using sub-shell; You do not need the last cd (which takes you home, not back where it came from): alias fixpermissions = '(cd ~ / public_html / Wp-content / themes / presstheme; find -fype f -exec chmod 644 {} \ ;; find. -type d -exec chmod 755 {} \;) ' And, Ever since I start using the shells before the aliases, I make it in a sketchy script in my bin directory:
cd ~ / public_html / wp-content / themes / Presstheme find-type f -exec chmod 644 {} \; Find-type d -exec chmod 755 {} \; And maybe I would also like to parametry it:
cd $ {1: - "~ / public_html / wp-content / themes / presstheme"} Find-type f -exec chmod 644 {} \; Find-type d -exec chmod 755 {} \; Then I can specify a different directory if I wanted to, but it would default to 'normal'.
Comments
Post a Comment