Skip to content

Instantly share code, notes, and snippets.

@X140Yu
X140Yu / script.swift
Last active July 1, 2019 09:27 — forked from lexrus/auto-run.swift
每次执行 script.swift 都会检查是否需要重新编译,最后会执行编译后的 script.swiftc。
/*/../usr/bin/true
source="$0"
compiled="$0"c
if [[ "$source" -nt "$compiled" ]]; then
DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer xcrun swiftc -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -g "$source" -o "$compiled" || exit
fi
"$compiled"