IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    Get Ubuntu release code name in Script

    bear发表于 2023-12-24 17:39:54
    love 0
    $ lsb_release -h
    Usage: lsb_release [options]
    
    Options:
      -h, --help         show this help message and exit
      -v, --version      show LSB modules this system supports
      -i, --id           show distributor ID
      -d, --description  show description of this distribution
      -r, --release      show release number of this distribution
      -c, --codename     show code name of this distribution
      -a, --all          show all of the above information
      -s, --short        show requested information in short format
    
    
    $ lsb_release -a
    No LSB modules are available.
    Distributor ID:	Ubuntu
    Description:	Ubuntu 22.04.3 LTS
    Release:	22.04
    Codename:	jammy
    
    
    $ lsb_release -sc
    jammy
    
    $ lsb_release -sr
    22.04

    Use it in Shell Script

    echo "deb http://apt.kubernetes.io/ kubernetes-$(lsb_release -sc) main kubernetes-$(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/kubernetes.list


沪ICP备19023445号-2号
友情链接