Differences between version 3 and previous revision of KnowledgeBase/Scripts/clone.sh.
Other diffs: Previous Major Revision, Previous Author
Newer page: | version 3 | Last edited on Sunday, 19 April 2009 13:34:53 | by CyberLeo | Revert |
Older page: | version 2 | Last edited on Sunday, 19 April 2009 11:32:02 | by CyberLeo | Revert |
@@ -1,6 +1,5 @@
-<?plugin RawHtml
-<pre class="brush:
bash;"
>
+<code
bash>
#!/bin/sh
src="${1}"
dst="${2}"
@@ -32,6 +31,5 @@
echo "Hardlinking files..."
( cd "${src}" && find . -type f -print ) | while read file; do ln "${src}/${file}" "${dst}/${file}"; done
echo "All done!"
-</pre>
-?
>
+</code
>
version 3
#!/bin/sh src="${1}" dst="${2}" if [ -z "${src}" -o -z "${dst}" ] then echo "Usage: $(basename "${0}") <source> <dest>" echo "Clones the source directory tree into destination, hardlinking all files." echo "Useful for kernel build trees, when you wanna keep everything separate." exit 64 fi if [ ! -d "${src}" ] then echo "${src} doesn't appear to be a directory." exit 32 fi if [ -e "${dst}" ] then echo "${dst} already exists. Not overwriting." exit 16 fi echo "Creating directory structure..." mkdir -p "${dst}" ( cd "${src}" && find . -type d -print0 ) | ( cd "${dst}" && xargs -0 mkdir -p ) echo "Hardlinking files..." ( cd "${src}" && find . -type f -print ) | while read file; do ln "${src}/${file}" "${dst}/${file}"; done echo "All done!"