Ubuntuのバージョンを見失いました。
2012-09-28追加
ターミナルから
cat /etc/lsb-release
実行結果
takuya@atom:~$ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=12.04 DISTRIB_CODENAME=precise DISTRIB_DESCRIPTION="Ubuntu 12.04 LTS"
Linux共通な方法は
コマンド lsb_release -a を使う。
出力結果
$>lsb_release -a #5秒程度まつ No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 8.04.2 Release: 8.04 Codename: hardy
Pythonで出来たコマンド。
ちなみに、Ctrl+Cでとめたら、
$>lsb_release -a ^c #止める Traceback (most recent call last): File "/usr/bin/lsb_release", line 327, in <module> main() File "/usr/bin/lsb_release", line 291, in main distinfo = get_distro_information() File "/usr/bin/lsb_release", line 254, in get_distro_information distinfo = guess_debian_release() File "/usr/bin/lsb_release", line 213, in guess_debian_release rinfo = guess_release_from_apt() File "/usr/bin/lsb_release", line 140, in guess_release_from_apt releases = parse_apt_policy() File "/usr/bin/lsb_release", line 125, in parse_apt_policy policy = commands.getoutput('apt-cache policy 2>/dev/null') File "/usr/lib/python2.5/commands.py", line 44, in getoutput return getstatusoutput(cmd)[1] File "/usr/lib/python2.5/commands.py", line 54, in getstatusoutput text = pipe.read() KeyboardInterrupt