Browse Source

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

Alois Mahdal 3 years ago
parent
commit
0430d68a16
1 changed files with 27 additions and 0 deletions
  1. 27
    0
      dotfiles/bash/main.bashrc

+ 27
- 0
dotfiles/bash/main.bashrc View File

13
 ### SUBZ ###
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
 bb() {
43
 bb() {
17
     #
44
     #
18
     # Ring the bell
45
     # Ring the bell