我看到了这篇关于找出安装了什么发行版的所有不同方法的帖子,所以我正在尝试编写一个脚本来尝试所有这些方法。可能的命令包括:
$ 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) 我正在尝试将此代码从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)