Browse Source

Replace `dt` alias with more powerfule functions

Alois Mahdal 7 years ago
parent
commit
aca643e6eb
1 changed files with 27 additions and 1 deletions
  1. 27
    1
      dotfiles/bash/main.bashrc

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

12
 ### SUBZ ###
12
 ### SUBZ ###
13
 ### '''' ###
13
 ### '''' ###
14
 
14
 
15
+
16
+dt() {
17
+    #
18
+    # Open $1 new terminals
19
+    #
20
+    __bashum_run_n "${1:-1}" urxvt
21
+}
22
+
23
+dT() {
24
+    #
25
+    # Open $1 new alterminals
26
+    #
27
+    __bashum_run_n "${1:-1}" xfce4-terminal
28
+}
29
+
30
+__bashum_run_n() {
31
+    #
32
+    # Run $2 in background $1 times
33
+    #
34
+    local n=${1:-1}
35
+    while test "$n" -gt 0;
36
+    do
37
+        "$2" &
38
+        ((n--))
39
+    done
40
+}
41
+
15
 git() {
42
 git() {
16
     #
43
     #
17
     # /usr/bin/git wrapper just to disable dangerous commands
44
     # /usr/bin/git wrapper just to disable dangerous commands
225
 shopt -s histverify
252
 shopt -s histverify
226
 
253
 
227
 # some more aliases
254
 # some more aliases
228
-alias dt='urxvt &'
229
 alias cal='cal -m'
255
 alias cal='cal -m'
230
 alias cls='clear'
256
 alias cls='clear'
231
 alias ll='ls -lh'
257
 alias ll='ls -lh'