小编inu*_*aze的帖子

如何编写有效确定发行版名称的脚本?

我看到了这篇关于找出安装了什么发行版的所有不同方法的帖子,所以我正在尝试编写一个脚本来尝试所有这些方法。可能的命令包括:

$ cat /etc/lsb-release 
$ cat /etc/issue 
$ dmesg | head -1
$ cat /proc/version 
$ cat /etc/slackware-version 
$ cat/etc/debian-verion 
Run Code Online (Sandbox Code Playgroud)

我试着写这样的东西(我通常说西班牙语,所以它是西班牙语):

function Nombre_SO()
{

    DistroName="Linux"
    if [ $DistroName = Linux ] ;
    then

# Debian
    debian=`cat /etc/debian_version | cut -d " " -f01 | tr '[:upper:]' '[:lower:]'`
    if [ "$debian" = "debian" || "squeeze/sid" || "lenny" ]; 
        then
        DistroName="debian"
        else
        echo "Esto no es debian"
    fi

# Slackware
    slackware=`cat /etc/slackware-version | cut -d " " -f01` …
Run Code Online (Sandbox Code Playgroud)

distros linux

13
推荐指数
1
解决办法
1084
查看次数

Bash 脚本 - Wget 图形化下载进度

我正在尝试将此代码从wget + zenity移植到wget + kdialog.
代码zenity

#!/bin/bash

# Start wget | zenity
# Note the & at the end of the pipe, this allows the script to continue with wget running in the background

wget http://www.zezeniaonline.com/download/downloadlinux 2>&1 | sed -u 's/.* \([0-9]\+%\)\ \+\([0-9.]\+.\) \(.*\)/\1\n# Downloading at \2\/s, ETA \3/' | zenity --progress --title="Downloading File..." 

#Start a loop testing if zenity is running, and if not kill wget
RUNNING=0
while [ $RUNNING -eq 0 ] …
Run Code Online (Sandbox Code Playgroud)

bash download x11 wget

5
推荐指数
1
解决办法
3389
查看次数

标签 统计

bash ×1

distros ×1

download ×1

linux ×1

wget ×1

x11 ×1