Browse Source

Try to be smart about cal utility version

Alois Mahdal 5 years ago
parent
commit
885313faf8
1 changed files with 17 additions and 1 deletions
  1. 17
    1
      dotfiles/bash/main.bashrc

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

@@ -417,6 +417,23 @@ yum_hasbin() {
417 417
     done
418 418
 }
419 419
 
420
+cal() {
421
+    #
422
+    # cal with the proper version pick
423
+    #
424
+    local cal_v
425
+    local cal_es
426
+    cal_v=$(command cal -V 2>/dev/null); cal_es=$?
427
+    case $cal_es:$cal_v in
428
+        0:cal\ from\ util-linux\ 2.32.1)
429
+            command cal --color=always --monday --week "$@"
430
+            ;;
431
+        64:*)
432
+            command cal -M "$@"
433
+            ;;
434
+    esac
435
+}
436
+
420 437
 ### .... ###
421 438
 ### BASH ###
422 439
 ### '''' ###
@@ -436,7 +453,6 @@ GLOBIGNORE=.:..
436 453
 shopt -s histverify
437 454
 
438 455
 # some more aliases
439
-alias cal='cal -m'
440 456
 alias cls='clear'
441 457
 alias czkrates='czkrates -v'
442 458
 alias ll='ls -lh'