output asked headers in the order they were asked; avoid header name spoofing by...
[hband-tools.git] / user-tools / rn
blobcb8cbde3abd62cc0acca43da647f33d9f9bd4c04
1 #!/bin/bash
3 if [ "$1" = --help ]
4 then
5 echo "Rename one file, no overwrite:
6 rn [<OLDNAME>] [<NEWNAME>]
7 Rename 1 or more than 2 files interactively:
8 rn [<FILENAME-1> [<FILENAME-2> [...]]]"
9 exit
12 if [ $# = 2 ]
13 then
14 if [ "$1" = "$2" ]
15 then
16 exit 0
19 if [ ! -e "$2" -o -d "$2" ]
20 then
21 mv -n "$@"
22 # set error status if the first file still exists (rename was not successful)
23 test ! -e "$1" || exit 17
24 else
25 renamemanual "$@"
27 else
28 renamemanual "$@"