Mac "izle" veya "inotifywait" gibi bir komut var mı?
Benim Mac (Snow Leopard) üzerinde bir klasör ve bir komut dosyası (ne adını veren sadece bir klasör (bir parametre olarak... x.içine taşındı ve daha sonra idam etmek istiyorum"") filename) sh.
Tüm bash up (x.yazılmış bir senaryo var sh) dir içine oluşturulan giriş bazı dosyalar ve diğer şeyler 1 dolar sadece) yeni dosyaları/klasörleri/taşındığında bana dosya adını vermeye gerek hareket edecek.
Bu tür herhangi bir komut?
CEVAP
fswatch
fswatch X FSEvents bir dizin izlemek için API küçük bir program Mac OS kullanıyor.
Bu dizin için herhangi bir değişiklik ile ilgili bir olay alındığında, belirtilen
kabuk komutu /bin/bash
tarafından yürütülür
Eğer GNU/Linux üzerinde iseniz
inotifywatch (bir parçası
En dağıtımları inotify-tools
paket) benzer sağlar
işlevselliği.
Güncelleme:fswatch
BSD ve Debian da dahil olmak üzere birçok platformlarda kullanılabilir.
/ Basit Bir Örnek Sözdizimi
Birden fazla yolu izleyebileceği yeni bir yol içinSürüm 1.x ve daha yüksek:
fswatch -o ~/path/to/watch | xargs -n1 ~/script/to/run/when/files/change.sh
Eski yolsürüm 0.x:
fswatch ~/path/to/watch ~/script/to/run/when/files/change.sh
Homebrew ile yükleme
9/12/13 homebrew yay geri eklendi! Yani, formül listesi (brew update
) güncelleme ve daha sonra tüm yapmanız gereken budur:
brew install fswatch
2 saniye (**20) yükler:
Homebrew olmadan yükleme
Tipi Terminal.app
Bu komutları
cd /tmp
git clone https://github.com/alandipert/fswatch
cd fswatch/
make
cp fswatch /usr/local/bin/fswatch
Eğer sisteminizde c
bir derleyici yok, olsaydı zaten böyle büyük mükafat yüklemek veya komut satırı araçları böyle büyük mükafat için, hem ücretsiz gerekebilir. Eğer durum bu ise, muhtemelen 21* *gerekir.
fswatch
Sürüm 1 için ek Seçenekler.x
Usage:
fswatch [OPTION] ... path ...
Options:
-0, --print0 Use the ASCII NUL character (0) as line separator.
-1, --one-event Exit fsw after the first set of events is received.
-e, --exclude=REGEX Exclude paths matching REGEX.
-E, --extended Use exended regular expressions.
-f, --format-time Print the event time using the specified format.
-h, --help Show this message.
-i, --insensitive Use case insensitive regular expressions.
-k, --kqueue Use the kqueue monitor.
-l, --latency=DOUBLE Set the latency.
-L, --follow-links Follow symbolic links.
-n, --numeric Print a numeric event mask.
-o, --one-per-batch Print a single message with the number of change events.
in the current batch.
-p, --poll Use the poll monitor.
-r, --recursive Recurse subdirectories.
-t, --timestamp Print the event timestamp.
-u, --utc-time Print the event time as UTC time.
-v, --verbose Print verbose output.
-x, --event-flags Print the event flags.
See the man page for more information.
Nasıl " devre dışı bırakmak;GİRİN ...
Ekle " nasıl Bash, emin [E/H]"...
SVN ayar "idam" Subversion d...
Java "-by pass-başvuru" veya...
Href JavaScript bağlantıları için özni...