Sponsored Content
Top Forums Shell Programming and Scripting Linux distro from bash script Post 302159810 by Samtim74 on Friday 18th of January 2008 06:24:59 PM
Old 01-18-2008
Linux distro from bash script

hello ALL,

I wander, is there an easy way to get information which linux distro and its version a script runs on?

I'm looking for a function like getDistroInfo(), which would return strings like "Ubuntu7.10" or "SLES10" or "RHEL5" etc.
uname returns lots of stuff, but distro info.
/etc/issue has different formats depending on distro (which is not really convenient if you don't know the distro). Does anybody have an idea?


Thanx!
Alex
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Linux distro

Hi I'm have old toshiba laptop(t1900) 486, 4mbRAM and ~120MB of hdd I'm looking for distro to suite my comp, no need for X windows but not enything that runs on FAT, just normal small Linux. Actually, *BSDs will do as well. If u know any distro that would do this I will be thankful for hint ... (4 Replies)
Discussion started by: wolk
4 Replies

2. UNIX for Advanced & Expert Users

Copying a Linux distro from one partition to the other...

Hola. Here is how my partition table looks: Device Boot Start End Blocks Id System /dev/hde1 1 1689 13566861 7 HPFS/NTFS /dev/hde2 * 1690 2783 8787555 83 Linux /dev/hde3 2784 2813 240975 82 Linux swap /dev/hde4 ... (5 Replies)
Discussion started by: Mr_Proper
5 Replies

3. AIX

A thing AIX would do it like no other Linux distro?

Hi, I would like to know, is there a thing that AIX would do it, and RHEL or SLES would not? Something specific and great in the same time. It might sound weird, but I'm very curios. Thanks a lot guys! (7 Replies)
Discussion started by: aixn00b
7 Replies

4. UNIX for Dummies Questions & Answers

New to linux. Which distro should i use?

want to know which Linux distro is 4 me. want 2 teach my self programing and problem solving. i want to learn code and write code. i have an acer aspire one 2GB memory 160 GB HDD intel Atom. look im as noobie as it gets im a MS xp, vista boy want to go beyond graphical click and do... any help... (1 Reply)
Discussion started by: BizilStank
1 Replies

5. What is on Your Mind?

Creating a Linux Distro

I have been using Linux OS since 4 years and I'm very interested to know how to create a Linux Distro. I have heard about LFS. I would just like to know, what do I need to create a Linux Distro? I'm not a programmer, if I have to create a Linux Distro, what programming languages do I need to... (3 Replies)
Discussion started by: Auzern
3 Replies

6. Linux

Best Linux desktop distro

I hate the fact that my first post is this. Anyhow, I've been using Linux distros such as Ubuntu, Fedora, Debian, openSUSE, and a few others for quite some time now. I've never had a problem with any distro, thus saying that they were all good in my opinion. I've been reading a lot on different... (2 Replies)
Discussion started by: Vex
2 Replies

7. UNIX for Advanced & Expert Users

Help creating a custom linux distro

Hi all, for a while now I've been working on a linux distro and I'm a couple of tweaks away from it to be perfected so if any experts want to help me out please message me. Thanks in advance. (I know I've posted a similar thread on the same topic but it was closed due to an unhelpful title... (0 Replies)
Discussion started by: allk
0 Replies

8. Linux

Best Linux Distro

Hello, I have a Compaq Presario v3000 5 year old laptop, with 1 GB RAM and currently running the (slow and stupid) Windows 7 32 bit, thus I would like to dual boot it with an appropriate distro of Linux that 1) Doesnt consume too much resources (1 GB RAM is not a lot of space) and it ll be... (4 Replies)
Discussion started by: ajayram
4 Replies

9. Open Source

What is your favorite Linux distro?

What is your favorite Linux distro? and possibly why? Personally, I have Fedora 3 on my computer. I have used Ubuntu and Slackware, too. But I think I liked Ubuntu more, maybe because of its speed and easy installation of packages. (192 Replies)
Discussion started by: milhan
192 Replies
SCRIPT(1)							   User Commands							 SCRIPT(1)

NAME
script - make typescript of terminal session SYNOPSIS
script [options] [file] DESCRIPTION
script makes a typescript of everything displayed on your terminal. It is useful for students who need a hardcopy record of an interactive session as proof of an assignment, as the typescript file can be printed out later with lpr(1). If the argument file is given, script saves the dialogue in this file. If no filename is given, the dialogue is saved in the file type- script. OPTIONS
-a, --append Append the output to file or to typescript, retaining the prior contents. -c, --command command Run the command rather than an interactive shell. This makes it easy for a script to capture the output of a program that behaves differently when its stdout is not a tty. -e, --return Return the exit code of the child process. Uses the same format as bash termination on signal termination exit code is 128+n. -f, --flush Flush output after each write. This is nice for telecooperation: one person does `mkfifo foo; script -f foo', and another can supervise real-time what is being done using `cat foo'. --force Allow the default output destination, i.e. the typescript file, to be a hard or symbolic link. The command will follow a symbolic link. -q, --quiet Be quiet (do not write start and done messages to standard output). -t[file], --timing[=file] Output timing data to standard error, or to file when given. This data contains two fields, separated by a space. The first field indicates how much time elapsed since the previous output. The second field indicates how many characters were output this time. This information can be used to replay typescripts with realistic typing and output delays. -V, --version Display version information and exit. -h, --help Display help text and exit. NOTES
The script ends when the forked shell exits (a control-D for the Bourne shell (sh(1)), and exit, logout or control-d (if ignoreeof is not set) for the C-shell, csh(1)). Certain interactive commands, such as vi(1), create garbage in the typescript file. script works best with commands that do not manipulate the screen, the results are meant to emulate a hardcopy terminal. It is not recommended to run script in non-interactive shells. The inner shell of script is always interactive, and this could lead to unexpected results. If you use script in the shell initialization file, you have to avoid entering an infinite loop. You can use for example the .profile file, which is read by login shells only: if test -t 0 ; then script exit fi You should also avoid use of script in command pipes, as script can read more input than you would expect. ENVIRONMENT
The following environment variable is utilized by script: SHELL If the variable SHELL exists, the shell forked by script will be that shell. If SHELL is not set, the Bourne shell is assumed. (Most shells set this variable automatically). SEE ALSO
csh(1) (for the history mechanism), scriptreplay(1) HISTORY
The script command appeared in 3.0BSD. BUGS
script places everything in the log file, including linefeeds and backspaces. This is not what the naive user expects. script is primarily designed for interactive terminal sessions. When stdin is not a terminal (for example: echo foo | script), then the session can hang, because the interactive shell within the script session misses EOF and script has no clue when to close the session. See the NOTES section for more information. AVAILABILITY
The script command is part of the util-linux package and is available from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils /util-linux/>. util-linux June 2014 SCRIPT(1)
All times are GMT -4. The time now is 09:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy