blob: 4cbb5f5a653eb12da985bf861237c184ed064e47 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#!/bin/bash
#Author : Amirreza Firoozi
#License : GPL3
#This is a simple script that find distro name and echo (return) it.
#Its useful if you want to know what distro is your own script running on.
distros=( "Arch" "Ubuntu" "Debian" "Suse" )
dId=0
while [ "1" == "1" ];do
grep -i "${distros[dId]}" /etc/issue 1>/dev/null 2>&1
exstatus=$?
if [ "$exstatus" == "0" ];then
distro=${distros[dId]}
if [ "$1" == "-o" ];then
echo "$distro" > $2
else
echo "$distro"
fi
break
fi
if [ "$dId" -gt "${#distros[@]}" ];then
break
fi
((dId++))
done
|