diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-07-30 00:10:25 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-07-30 00:12:28 +1200 |
commit | 692419ad2a7026b3fd95b2cd4df1748892b579d6 (patch) | |
tree | 038704e0ba24950dabce615b121a54810e5be90d | |
parent | Add rule for kvlt(6) to change numbers to 666 (diff) | |
download | dotfiles-692419ad2a7026b3fd95b2cd4df1748892b579d6.tar.gz dotfiles-692419ad2a7026b3fd95b2cd4df1748892b579d6.zip |
Change mkmv/mkcp from Bash funcs to sh scripts
-rw-r--r-- | README.markdown | 4 | ||||
-rw-r--r-- | bash/bashrc.d/mkcp.bash | 4 | ||||
-rw-r--r-- | bash/bashrc.d/mkmv.bash | 4 | ||||
-rwxr-xr-x | bin/mkcp | 6 | ||||
-rwxr-xr-x | bin/mkmv | 6 | ||||
-rw-r--r-- | man/man1/mkcp.1 | 19 | ||||
-rw-r--r-- | man/man1/mkmv.1 | 19 |
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> |