Bash いろいろメモ。

  • .bashrc から .bash_aliases.bash_functions を分割した。 これでセッションを維持したままファイルを編集した結果を source して定義を上書きできる。
  • /proc/version: This file specifies the version of the Linux kernel, the version of gcc used to compile the kernel, and the time of kernel compilation (System Administration Guide, E.2.29. /proc/version)

    # Cygwin bash
    [cygwin bash ~]$ cat /proc/version
    CYGWIN_NT-10.0-18362 version 3.0.7-338.x86_64 (corinna@calimero) (gcc version 7.4.0 20181206 (Fedora Cygwin 7.4.0-1) (GCC) ) 2019-04-30 18:08 UTC
    
    # MSYS2 bash
    [msys bash ~]$ cat /proc/version
    MSYS_NT-10.0 version 2.10.0(0.325/5/3) (Alexx@WARLOCK) (gcc version 6.4.0 (GCC) ) 2018-02-09 15:25
    
    # bash in Git for Windows
    [msys bash ~]$ cat /proc/version
    MINGW64_NT-10.0-18362 version 3.0.7-338.x86_64 (@7d8dc4f7d392) (gcc version 7.4.0 (GCC) ) 2019-07-03 15:16 UTC
    
  • VS Code のインストールフォルダーのどこかにある cmd というシェルスクリプトがある。 この中に書いてある環境判定ロジックがたいへん参考になる。