-
Notifications
You must be signed in to change notification settings - Fork 2
/
oldUNIX_shell.vch
executable file
·76 lines (48 loc) · 1.82 KB
/
oldUNIX_shell.vch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
include "machines.vch";
PLACE(before, after) := $before $after {left_ Len($after) };
SHELL(pathname) := Replace($pathname, " ", "\ ");
##
## miscellaneous Shell commands
##
<common_actions> := (edit="vim" | source="source");
edit vim config = {Esc}"ivim ~/.vimrc"{Enter};
<common_actions> bash config = {Esc}"i$1 ~/.bashrc"{Enter};
bash history = {Esc}{Ctrl+r};
break = {Esc}{Ctrl+c};
##
## Directory information/listing commands
##
<show> := ( show = ""
| show some of = " | head"
| show a lot of = " | head -n 50"
| local show = {ctrl+a}l{ctrl+e} # for use with sftp
);
<desc> := (long = -l | full = -A | recent = -t | recursive = -R | human = -h);
<show> [<desc> [<desc> [<desc>]]] directory =
ls When($2," $2") When($3," $3") When($4," $4") $1{enter};
show disk space = "df -h .{enter}" Empty();
<usage> := (usage="-h" | usage kilobytes="" | usage megabytes="-m");
show disk <usage> = "du $1 -s -- ""`ls --color=none -A`"" .{enter}" Empty();
##
## Macros for (s)ftp/ssh:
##
# make ssh connection to given machine, user pair:
secure login [to] <machine> = "ssh -X $1{enter}";
S F T P <machine> = "sftp $1{enter}";
# see local show ... directory above (= lls ...)
multiple get = "mget ";
local change directory = "lcd ";
local working directory = lpwd{enter};
##
## Macros for scp:
##
# add -p to preserve times, permissions:
<scp> := ( secure copy = "scp" | secure recursive copy = "scp -r"
| recursive secure copy = "scp -r"
| secure clone = "scp -p -r");
CopyFrom(scp, origin) := PLACE("$scp " SHELL($origin), " .");
CopyTo (scp, target) := PLACE("$scp ", " " SHELL($target));
<scp> from <machine> [/ <UNIX> [/ <COM>]] =
CopyFrom($1,"$2:" When($3,$3/) When($4,$4/));
<scp> to <machine> [/ <UNIX> [/ <COM>]] =
CopyTo ($1,"$2:" WHEN3($3,$3/,~/) When($4,$4/));