-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmlkh.awk
More file actions
executable file
·35 lines (27 loc) · 823 Bytes
/
Copy pathmlkh.awk
File metadata and controls
executable file
·35 lines (27 loc) · 823 Bytes
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
#!/usr/local/bin/gawk -f
function just_do_it() {
printf "Just Do It!\n"
}
function get_first_char(word) {
return substr(tolower(word),1,1)
}
{
hd_1 = sprintf("%s/%s",get_first_char($1),$1)
hd_2 = sprintf("%s/%s",get_first_char($2),$2)
cmd_make_link_1=sprintf("[[ -e %s ]] || mkdir -p -- %s && cd -- %s && ln -s ../../%s && cd ../..",hd_1,hd_1,hd_1,hd_2)
cmd_make_link_2=sprintf("[[ -e %s ]] || mkdir -p -- %s && cd -- %s && ln -s ../../%s && cd ../..",hd_2,hd_2,hd_2,hd_1)
cmd_open_1=sprintf("open %s",hd_1)
cmd_open_2=sprintf("open %s",hd_2)
print(cmd_make_link_1)
system(cmd_make_link_1)
close(cmd_make_link_1)
print(cmd_make_link_2)
system(cmd_make_link_2)
close(cmd_make_link_2)
print(cmd_open_1)
system(cmd_open_1)
close(cmd_open_1)
print(cmd_open_2)
system(cmd_open_2)
close(cmd_open_2)
}