应该不会消失的链接:
1、https://infoq.cn/article/inotify-linux-file-system-event-monitoring
2、http://ju.outofmemory.cn/entry/264098
3、http://icodeit.org/2015/03/build-monitor-script-based-on-inotify/ ,他有提到mac用fswatch
4、http://ju.outofmemory.cn/entry/278544 有一个现成的同步脚本
其实我5年前有写过一个inotifywait + php 的脚本,主要是用来检测哪些文件被人修改了,用做防篡改。可能最近会重新用上,温故一下旧知识点
简单的弄一下。因为有时候要改配置,然后打开mamp,点击重启会耗时特别长。。。。所以简单的弄了一下
XML/HTML代码
- #!/bin/bash
-
- function start(){
- /Applications/MAMP/Library/bin/httpd -f "/Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf" -k start
- }
-
- function stop(){
- /Applications/MAMP/Library/bin/httpd -f "/Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf" -k stop
- }
-
- function restart(){
- (stop)
- (start)
- }
-
- function status(){
- ps aux|grep httpd
- }
-
- echo "which do you want to?input the number."
- echo "1. start"
- echo "2. stop"
- echo "3. restart"
- echo "4. status"
- read num
-
- case "$num" in
- [1] ) (start);;
- [2] ) (stop);;
- [3] ) (restart);;
- [4] ) (status);;
- *) echo "exit";;
- esac
1、 如何获取字符串的长度:
在判断长度是否大于0的时候,if [xxx length ] > 0 就行了。而如果直接用swift,就不能写 if xxx.length > 0 了。因为xxx没有length这个方法。
有两个办法:
- if countElements(xxx) > 0
- if xxx.utf16count > 0
2、swift的delegate不象oc那样一个个的标注,只要在class头上写明就OK了
比如 class ViewController : UIViewController , UIActionSheetDelegate {
}
就能直接用UIActionSheetDelegate中的方法了。然后他们的delegate写self即可
刚开始学。不知道对错,目前就这样先纯做笔记,当然 你也可以delegate: nil 这样代表你这个控件 就不再接受委托了