aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-07-30 00:10:25 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-07-30 00:12:28 +1200
commit692419ad2a7026b3fd95b2cd4df1748892b579d6 (patch)
tree038704e0ba24950dabce615b121a54810e5be90d
parentAdd rule for kvlt(6) to change numbers to 666 (diff)
downloaddotfiles-692419ad2a7026b3fd95b2cd4df1748892b579d6.tar.gz
dotfiles-692419ad2a7026b3fd95b2cd4df1748892b579d6.zip
Change mkmv/mkcp from Bash funcs to sh scripts
-rw-r--r--README.markdown4
-rw-r--r--bash/bashrc.d/mkcp.bash4
-rw-r--r--bash/bashrc.d/mkmv.bash4
-rwxr-xr-xbin/mkcp6
-rwxr-xr-xbin/mkmv6
-rw-r--r--man/man1/mkcp.119
-rw-r--r--man/man1/mkmv.119
7 files changed, 52 insertions, 10 deletions
diff --git a/README.markdown b/README.markdown
index d4ed91cc..edc2f1eb 100644
--- a/README.markdown
+++ b/README.markdown
@@ -188,8 +188,6 @@ There are a few other little tricks in `bash/bashrc.d`, including:
* `hgrep` -- `HISTFILE` search
* `keep` -- Permanently store ad-hoc shell functions and variables
* `mkcd` -- Create a directory and change into it
-* `mkcp` -- Create a directory and copy arguments into it
-* `mkmv` -- Create a directory and move arguments into it
* `pa` -- Print given arguments, one per line
* `path` -- Manage the contents of `PATH` conveniently
* `paz` -- Print given arguments separated by NULL chars
@@ -321,6 +319,8 @@ Installed by the `install-bin` target:
* `jfcd(1)` watches a directory for changes and runs `jfc(1)` if it sees any.
* `maybe(1)` is like `true(1)` or `false(1)`; given a probability of success,
it exits with success or failure. Good for quick tests.
+* `mkcp(1)` creates a directory and copies preceding arguments into it
+* `mkmv(1)` creates a directory and moves preceding arguments into it
* `pit(1)` runs its input through a pager if its standard output looks like a
terminal.
* `plmu(1)` retrieves a list of installed modules from
diff --git a/bash/bashrc.d/mkcp.bash b/bash/bashrc.d/mkcp.bash
deleted file mode 100644
index 59eb0355..00000000
--- a/bash/bashrc.d/mkcp.bash
+++ /dev/null
@@ -1,4 +0,0 @@
-# Copy files into created directory in one call
-mkcp() {
- mkdir -p -- "${@: -1}" && cp -- "$@"
-}
diff --git a/bash/bashrc.d/mkmv.bash b/bash/bashrc.d/mkmv.bash
deleted file mode 100644
index 014fa150..00000000
--- a/bash/bashrc.d/mkmv.bash
+++ /dev/null
@@ -1,4 +0,0 @@
-# Move files into created directory in one call
-mkmv() {
- mkdir -p -- "${@: -1}" && mv -- "$@"
-}
diff --git a/bin/mkcp b/bin/mkcp
new file mode 100755
index 00000000..88876813
--- /dev/null
+++ b/bin/mkcp
@@ -0,0 +1,6 @@
+#!/bin/sh
+# Copy files into created directory in one call
+[ "$#" -gt 2 ] || exit 2
+for dir ; do : ; done
+mkdir -p -- "$dir" || exit
+exec cp -R -- "$@"
diff --git a/bin/mkmv b/bin/mkmv
new file mode 100755
index 00000000..d7e65ae2
--- /dev/null
+++ b/bin/mkmv
@@ -0,0 +1,6 @@
+#!/bin/sh
+# Move files into created directory in one call
+[ "$#" -gt 2 ] || exit 2
+for dir ; do : ; done
+mkdir -p -- "$dir" || exit
+exec mv -- "$@"
diff --git a/man/man1/mkcp.1 b/man/man1/mkcp.1
new file mode 100644
index 00000000..6db6ec1f
--- /dev/null
+++ b/man/man1/mkcp.1
@@ -0,0 +1,19 @@
+.TH MKCP 1 "July 2016" "Manual page for mkcp"
+.SH NAME
+.B mkcp
+\- create last argument as directory and copy remaining arguments into it
+.SH SYNOPSIS
+.B mkcp
+filea fileb newdir
+.br
+.B mkcp
+filea fileb newdir/newsubdir
+.SH DESCRIPTION
+.B mkcp
+combines mkdir(1) and cp(1) into one call, creating the last argument as a
+directory and recursively copying the remaining arguments into it. If the
+directory creation fails, the script stops before attempting the copy.
+.SH SEE ALSO
+mkdir(1), cp(1), mkmv(1)
+.SH AUTHOR
+Tom Ryder <tom@sanctum.geek.nz>
diff --git a/man/man1/mkmv.1 b/man/man1/mkmv.1
new file mode 100644
index 00000000..20679db2
--- /dev/null
+++ b/man/man1/mkmv.1
@@ -0,0 +1,19 @@
+.TH MKMV 1 "July 2016" "Manual page for mkmv"
+.SH NAME
+.B mkmv
+\- create last argument as directory and move remaining arguments into it
+.SH SYNOPSIS
+.B mkmv
+filea fileb newdir
+.br
+.B mkmv
+filea fileb newdir/newsubdir
+.SH DESCRIPTION
+.B mkmv
+combines mkdir(1) and mv(1) into one call, creating the last argument as a
+directory and moving the remaining arguments into it. If the directory creation
+fails, the script stops before attempting to move the files.
+.SH SEE ALSO
+mkdir(1), mv(1), mkcp(1)
+.SH AUTHOR
+Tom Ryder <tom@sanctum.geek.nz>