08-13-2008
simple script detect to find OS version/flavour
Hi,
A newbie question.
Following script gives no output.
===============================
root@srv [~]# cat /etc/redhat-release | awk {'print $1}'
Red
root@srv [~]# cat 123.sh
if (( `cat /etc/redhat-release | awk {'print $1}'` != CentOS )); then { echo "System runs on Redhat Linux. Exiting..."; exit; } fi
root@srv [~]# sh 123.sh
root@srv [~]#
root@srv [~]# if (( `cat /etc/redhat-release | awk {'print $1}'` != CentOS )); then { echo "System runs on Redhat Linux. Exiting..."; exit; } fi
root@srv [~]#
root@srv [~]# sh -x 123.sh
++ cat /etc/redhat-release
++ awk '{print $1}'
+ (( Red != CentOS ))
root@srv [~]#
Please advise or provide a alternative so that I can include it in a shell script that will use up2date, in case it is RHEL ( i am aware RHEL 5 use yum ) and will use yum incase it is CentOS
Thanks
Last edited by fed.linuxgossip; 08-13-2008 at 11:37 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
------------------------------
$x=" hi";
$tabspace=0;
while ($x =~ /\t/g )
{
$tabspace++;
}
print $tabspace;
---------------------------------
1.)when i tried it without "g" ($x = ~/\t/ )... when i run the script it utilizes around 95% cpu and system hangs and i did "End process"... (0 Replies)
Discussion started by: sekar sundaram
0 Replies
2. UNIX for Dummies Questions & Answers
Hi
I'm wondering how I can find all the files which were installed on certain date?
For example: I'm looking for alle the files which were installed on the 11.09.06 on the system.
Does somebody know how to do this?
Thanks
Reto (2 Replies)
Discussion started by: goldenglobe
2 Replies
3. Shell Programming and Scripting
Im trying to make a very simple find the first file with the .zip extension in a specific folder and open that file.
The folder path and file name will vary every-time and it may contain spaces. If I try to look
For this example the folder directory is /Users/username/Desktop/testfolder/abc... (6 Replies)
Discussion started by: elbombillo
6 Replies
4. Shell Programming and Scripting
Hi,
I have a log file containing data on emails sent. Looks a bit like this for one email:
Content-Type: text/plain;
charset="UTF-8"
Date: 12 Jun 2008 14:04:59 +0100
From: from@email.com
Subject: xcf4564xzcv
To: recip@email.co.uk
Size = 364 Jun 12 14:04 smtp_234sldfh.tmp
I need to... (5 Replies)
Discussion started by: terry2009
5 Replies
5. Shell Programming and Scripting
Hi,
We have a requirement to find the set of filenames from the group of files in a specified folder based on
(i) version number
(ii) sequence number
such that, for any given sequence number in a day only the latest version filenames have to indentified.
Below is the format of... (4 Replies)
Discussion started by: Deepakbabu
4 Replies
6. Shell Programming and Scripting
Hi ,
I want to write a simple script.
I have two files
file1:
BCSpeciality
Backend
CB
CBAPQualDisp
CBCimsVFTRCK
CBDSNQualDisp
CBDefault
CBDisney
CBFaxMCGen
CBMCGeneral
CBMCQualDisp
file2:
CSpeciality
Backend (8 Replies)
Discussion started by: ramky79
8 Replies
7. UNIX for Dummies Questions & Answers
HI guys,
Could you help me writing a simple version control script for a text files.
the format could be
./version_control <file(s)> (I want it to be able to work with more than 1 file at the same time)
commands are add and get, add means you add new file(s) to the archive, get means you... (4 Replies)
Discussion started by: s3270226
4 Replies
8. Shell Programming and Scripting
Hello all!
This is my first post and I'm very new to programming. I would like help creating a simple perl or bash script that I will be using in my work as a junior bioinformatician.
Essentially, I would like to take a tab-delimted or .csv text with 3 columns and write them to a "3D" matrix:
... (16 Replies)
Discussion started by: torchij
16 Replies
9. UNIX for Dummies Questions & Answers
Hi everyone. I've been reading around and am a little bit overwhelmed, hoping to find a kind soul out there to hold my hand through writing my first script. This need has emerged at work and I haven't much experience writing shell scripts, but this is a problem we have with a production environment... (13 Replies)
Discussion started by: thirdcoaster
13 Replies
10. Shell Programming and Scripting
Hello guys, im new to to unix/linux
i have a text file like this:
person1@test.com iisiiasasas
person2@test.com 123w2 3233
sajsja person3@test.com jsajjsa
sajsjasaj person4@test.com
I want to extract only e-mail address and get rid of all other stuff, i want an output like this
... (4 Replies)
Discussion started by: RazorMX
4 Replies
BIND(1) General Commands Manual BIND(1)
NAME
bind, mount, unmount - change name space
SYNOPSIS
bind [ option ... ] new old
mount [ option ... ] servename old [ spec ]
unmount [ new ] old
DESCRIPTION
Bind and mount modify the file name space of the current process and other processes in the same name space group (see fork(2)). For both
calls, old is the name of an existing file or directory in the current name space where the modification is to be made.
For bind, new is the name of another (or possibly the same) existing file or directory in the current name space. After a successful bind,
the file name old is an alias for the object originally named by new; if the modification doesn't hide it, new will also still refer to its
original file. The evaluation of new (see intro(2)) happens at the time of the bind, not when the binding is later used.
The servename argument to mount is the name of a file that, when opened, yields an existing connection to a file server. Almost always,
servename will be a file in /srv (see srv(3)). In the discussion below, new refers to the file named by the new argument to bind or the
root directory of the service available in servename after a mount. Either both old and new files must be directories, or both must not be
directories.
Options control aspects of the modification to the name space:
(none) Replace the old file by the new one. Henceforth, an evaluation of old will be translated to the new file. If they are directo-
ries (for mount, this condition is true by definition), old becomes a union directory consisting of one directory (the new file).
-b Both files must be directories. Add the new directory to the beginning of the union directory represented by the old file.
-a Both files must be directories. Add the new directory to the end of the union directory represented by the old file.
-c This can be used in addition to any of the above to permit creation in a union directory. When a new file is created in a union
directory, it is placed in the first element of the union that permits creation.
The spec argument to mount is passed in the attach(5) message to the server, and selects among different file trees served by the server.
The srv(3) service registry device, normally bound to /srv, is a convenient rendezvous point for services that can be mounted. After boot-
strap, the file /srv/boot contains the communications port to the file system from which the system was loaded.
The effects of bind and mount can be undone with the unmount command. If two arguments are given to unmount, the effect is to undo a bind
or mount with the same arguments. If only one argument is given, everything bound to or mounted upon old is unmounted.
EXAMPLES
To compile a program with the C library from July 16, 1992:
mount /srv/boot /n/dump dump
bind /n/dump/1992/0716/mips/lib/libc.a /mips/lib/libc.a
mk
SOURCE
/sys/src/cmd/bind.c
/sys/src/cmd/mount.c
/sys/src/cmd/unmount.c
SEE ALSO
bind(2), open(2), srv(3), srv(4)
BIND(1)