我想在文件更改时自动启动构建。
我已经在Ruby中使用了autospec(RSpec),并且喜欢它。
如何在bash中完成?
阅读其他帖子的回复后,我发现了一个帖子(现已消失),我创建了这个脚本:-
#!/bin/bash sha=0 previous_sha=0 update_sha() { sha=`ls -lR . | sha1sum` } build () { ## Build/make commands here echo echo "--> Monitor: Monitoring filesystem... (Press enter to force a build/update)" } changed () { echo "--> Monitor: Files changed, Building..." build previous_sha=$sha } compare () { update_sha if [[ $sha != $previous_sha ]] ; then changed; fi } run () { while true; do compare read -s -t 1 && ( echo "--> Monitor: Forced Update..." build ) done } echo "--> Monitor: Init..." echo "--> Monitor: Monitoring filesystem... (Press enter to force a build/update)" run