aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.bash_utils/file.sh
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-10-06 20:45:23 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2016-10-06 20:45:23 +0300
commitf05d745f30dea9810c42b75c5f191e57a68fa74a (patch)
treec74cb48b870eb0cc01bee4e798ef4e32bad9c3a3 /.bash_utils/file.sh
parentREADME update (diff)
downloadlinux-home-f05d745f30dea9810c42b75c5f191e57a68fa74a.tar.gz
linux-home-f05d745f30dea9810c42b75c5f191e57a68fa74a.zip
mustn't be a repository anymore
Diffstat (limited to '.bash_utils/file.sh')
-rw-r--r--.bash_utils/file.sh35
1 files changed, 0 insertions, 35 deletions
diff --git a/.bash_utils/file.sh b/.bash_utils/file.sh
deleted file mode 100644
index 0321833..0000000
--- a/.bash_utils/file.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/env bash
-
-# Copyright (c) 2016 Egor Tensin <Egor.Tensin@gmail.com>
-# This file is part of the "Cygwin configuration files" project.
-# For details, see https://github.com/egor-tensin/cygwin-home.
-# Distributed under the MIT License.
-
-swap_files() (
- set -o errexit -o nounset -o pipefail
-
- if [ "$#" -ne 2 ]; then
- echo "usage: ${FUNCNAME[0]} PATH1 PATH2" >&2
- return 1
- fi
-
- local path1="$1"
- local path2="$2"
-
- if [ ! -f "$path1" ]; then
- echo "${FUNCNAME[0]}: must be a regular file: $path1" >&2
- return 1
- fi
-
- if [ ! -f "$path2" ]; then
- echo "${FUNCNAME[0]}: must be a regular file: $path2" >&2
- return 1
- fi
-
- local tmp_path
- tmp_path="$( mktemp "$( dirname "$path1" )/XXX" )"
-
- mv "$path1" "$tmp_path"
- mv "$path2" "$path1"
- mv "$tmp_path" "$path2"
-)