Przeglądaj źródła

Add smv() and smvr() for "moving" files/trees via scp

Alois Mahdal 3 lat temu
rodzic
commit
0430d68a16
1 zmienionych plików z 27 dodań i 0 usunięć
  1. 27
    0
      dotfiles/bash/main.bashrc

+ 27
- 0
dotfiles/bash/main.bashrc Wyświetl plik

@@ -13,6 +13,33 @@ test -f /usr/share/git-core/contrib/completion/git-prompt.sh \
13 13
 ### SUBZ ###
14 14
 ### '''' ###
15 15
 
16
+smv() {
17
+    #
18
+    # scp but rm the source
19
+    #
20
+    local src=$1
21
+    local dst=$2
22
+    test $# -eq 2 || {
23
+        echo "i can only 2 argz!" >&2
24
+        return 2
25
+    }
26
+    scp "$src" "$dst" && rm "$src"
27
+}
28
+
29
+smvr() {
30
+    #
31
+    # smv but recursive
32
+    #
33
+    local src=$1
34
+    local dst=$2
35
+    test $# -eq 2 || {
36
+        echo "i can only 2 argz!" >&2
37
+        return 2
38
+    }
39
+    scp -r "$src" "$dst" && rm -r "$src"
40
+}
41
+
42
+
16 43
 bb() {
17 44
     #
18 45
     # Ring the bell