Shell: Unterschied zwischen den Versionen
Keine Bearbeitungszusammenfassung |
|||
| Zeile 5: | Zeile 5: | ||
==Cygwin rsync script Start== | ==Cygwin rsync script Start== | ||
./sync_heilsarmee.sh | ./sync_heilsarmee.sh | ||
== Recursively chmod only directories or files == | |||
http://rainsoftletters.wordpress.com/2008/07/22/recursively-chmodi-only-directories-or-files/ | |||
=== Recursively chmod directories only. === | |||
'''bash''' | |||
find . -type d -exec chmod 755 {} \+ # This will “find” all directories, starting at “.“, and chmod them to 755. | |||
find . -type d -exec chmod g+w {} \+ | |||
or | |||
chmod g-x `find . -type d` | |||
chmod 644 `find . -type d` | |||
'''fish''' | |||
chmod g+x (find . -type d) | |||
=== Recursively chmod files only === | |||
'''bash''' | |||
find . -type f -exec chmod 644 {} \+ | |||
or | |||
chmod 644 `find . -type f` | |||
This snippet does the opposite and finds only files. The difference (beside the file permissions) is the “-type f“, “f” specifies files and “d” directories. | |||
If you check the comments, you’LL3D find a few additional snippets: | |||
find . -type f -name '*.htm*' -exec chmod 644 {} \+ | |||
This lets you “find” files (“-type f“) with a specific extension (“-name '*.htm*'“) and chmod them with your desired permission (“-exec chmod 644 {}“). | |||
chmod -R o+rX | |||
This snippet will recursively chmod “other” (“o“) permissions with read/eXecutable (“+rX“), and the capital X ensures that directories and files set (user/group permissions) to executable will be properly modified, while ignoring regular (non-executable) files. | |||
'''fish''' | |||
chmod g+x (find . -type f) | |||
chmod 644 (find . -type f) | |||
Version vom 12. Januar 2017, 14:41 Uhr
Dos 2 Unix
dos2unix dateiname dos2unix *
Cygwin rsync script Start
./sync_heilsarmee.sh
Recursively chmod only directories or files
http://rainsoftletters.wordpress.com/2008/07/22/recursively-chmodi-only-directories-or-files/
Recursively chmod directories only.
bash
find . -type d -exec chmod 755 {} \+ # This will “find” all directories, starting at “.“, and chmod them to 755.
find . -type d -exec chmod g+w {} \+
or
chmod g-x `find . -type d` chmod 644 `find . -type d`
fish
chmod g+x (find . -type d)
Recursively chmod files only
bash
find . -type f -exec chmod 644 {} \+
or
chmod 644 `find . -type f`
This snippet does the opposite and finds only files. The difference (beside the file permissions) is the “-type f“, “f” specifies files and “d” directories. If you check the comments, you’LL3D find a few additional snippets:
find . -type f -name '*.htm*' -exec chmod 644 {} \+
This lets you “find” files (“-type f“) with a specific extension (“-name '*.htm*'“) and chmod them with your desired permission (“-exec chmod 644 {}“).
chmod -R o+rX
This snippet will recursively chmod “other” (“o“) permissions with read/eXecutable (“+rX“), and the capital X ensures that directories and files set (user/group permissions) to executable will be properly modified, while ignoring regular (non-executable) files.
fish
chmod g+x (find . -type f)
chmod 644 (find . -type f)