Sponsored Content
Top Forums Shell Programming and Scripting Comparing content of two variables Post 302542874 by animesharma on Friday 29th of July 2011 12:33:08 AM
Old 07-29-2011
Comparing content of two variables

I have very abstract need of "comparing two variables" and take subsequent actions.

please refer to image below
Image

I have a part of script which reads a file and generates variables based on content of this file.(Variables generated in same shell)

The reason i have categorized the design in user and script environment is that the script environment must be able to handle changes made in user environment.
The changes will only be in the form of new line entries in file1.txt

I need help on how to move from desired output to final outputSmilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

comparing file content differences

I need to write a script to find out if there are any .c files created/removed from the last time i monitored the files available. i first created a file to contain all the .c files available on the system. (ls *.c > file1) I created another file using the same command. I used the comm file1... (4 Replies)
Discussion started by: RianTan
4 Replies

2. UNIX for Dummies Questions & Answers

comparing variables

I have searched and found a few threads that have dealt with this, but the examples I've tried haven't seemed to help. I am monitoring our database log for high checkpoints. I can parse out the checkpoint value which can be anywhere from zero into a 3 digit number. I set a variable to be the... (3 Replies)
Discussion started by: MizzGail
3 Replies

3. Shell Programming and Scripting

Comparing two variables

Script #!/bin/sh hardware=PC os=WindowsNET for i in `cat newservers` do x=`sudo /opt/openv/netbackup/bin/admincmd/bpplclients |grep $i |head -40 |grep $i|awk '{print $3;exit}'` if then echo "$i is already added" else echo "Need to add" fi done O/p in debug mode bash-2.05$... (3 Replies)
Discussion started by: rajip23
3 Replies

4. Shell Programming and Scripting

comparing content of 2 variables in script

hello how can i compare the content of two variables using the if or for loops. I have 2 variables which was formed as result of commands pass into them but i want to now compare the 2 contents and echo where their is a match for examples variable1=`cat file2` variable2=`cat file3` if #... (5 Replies)
Discussion started by: sam4now
5 Replies

5. UNIX for Dummies Questions & Answers

comparing the content of two directories

Hello I want to compare the content of two directories recursively to check if the two directories have the same files. How can I do that? (2 Replies)
Discussion started by: xyzt
2 Replies

6. Shell Programming and Scripting

comparing files content

hi i have a set of files , i need to compare one file content with other file content, i am using cmp -s abc.1 def.2 , but it is not giving theproper o/p even if the content is different.Please help thanks Satya (1 Reply)
Discussion started by: Satyak
1 Replies

7. UNIX for Dummies Questions & Answers

comparing variables

im trying to compare ipaddresses. i loop through an array to see if the ip is already is in the array and if it is it should set a flag and then i wont add it to the array. but its just adding all the ipaddresses to the array if ] then ... (3 Replies)
Discussion started by: magnia
3 Replies

8. Shell Programming and Scripting

Comparing 2 csv files and matching content

Hello, I have the following problem: There are two csv files csv-file #1: aaa1, aaa2, ... aaan aaa1, bbb2, ... bbbn aaa1, ccc2, ... cccn bbb1, bbb2, ... bbbn ... zzz1, zzz2, ... zzzn csv-file #2: aaa1, matchvalue1 ccc1, matchvalue2 (7 Replies)
Discussion started by: ghl10000
7 Replies

9. Shell Programming and Scripting

comparing 2 files and creating third file with uncommon content

I want to compare 2 files and create third file with uncommon content. e.g. file1 ajay suhas tom nisha vijay mahish file2 ajay suhas tom nisha expected output file content vijay mahish Is it possible in single command ? Thanks, Ajay (6 Replies)
Discussion started by: ajaypatil_am
6 Replies

10. Shell Programming and Scripting

Comparing two variables

I have a script like this. Just couldn't get the comparison part work. Any thought? thanks, #!/usr/bin/ksh -x STEP=`echo $(basename $0 .ksh) | tr "" ""` log=/skip.log while read LINE do if then echo `date`: STEP $STEP skipped by user >> $log exit 0 fi done < $1 echo... (0 Replies)
Discussion started by: ghostmic
0 Replies
KERNEL-IMG.CONF(5)					      Debian GNU/Linux manual						KERNEL-IMG.CONF(5)

NAME
kernel-img.conf - site wide configuration file for kernel image packages SYNOPSIS
/etc/kernel-img.conf DESCRIPTION
The file /etc/kernel-img.conf is a simple file looked at by the kernel image post installation process to allow local options for handling some aspects of the installation, overriding the defaults built into the image itself. The format of the file is a simple VAR=VALUE pair. Boolean values may be specified as Yes, True, 1, and No, False, 0, and are case insensi- tive. This file is automatically created by the installation script in certain circumstances. At the moment, the user modifiable variables supported are: postinst_hook DEPRECATED: Set this variable to a script to be executed during installation. The path can be a relative path if the script lives in a safe path -- that is, if it lives in /bin, /sbin, /usr/bin, or /usr/sbin, or must be an absolute path instead. Before calling this script, the env variable STEM shall be set to the value of the --stem argument (or the default value, linux), and KERNEL_PACK- AGE_VERSION shall be set to the version of the kernel-package that created the package. This script shall be called with two argu- ments, the first being the version of the kernel image, and the second argument being the location of the kernel image itself. Errors in the script shall cause the postinst to fail. Since debconf is in use before the script is called, this script should issue no diagnostic messages to stdout -- while the postinst does call db_stop, debconf does not restore stdout, so messages to stdout disappear. An example script for grub users is present in /usr/share/doc/kernel-package/ directory. This script is run after the scripts in /etc/kernel/postinst.d directory. postrm_hook DEPRECATED: Set this variable to a script to be executed in the postrm (that is, after the image has been removed) after all the remove actions have been performed. The path can be a relative path if the script lives in a safe path -- that is, if it lives in /bin, /sbin, /usr/bin, or /usr/sbin, or must be an absolute path instead. The environment variable KERNEL_PACKAGE_VERSION shall be set to the version of the kernel-package that created the package. This script shall be called with two arguments, the first being the version of the kernel image, and the second argument being the location of the kernel image itself. Errors in the script shall produce a warning message, but shall be otherwise ignored. Since debconf is in use before the script is called, this script should issue no diagnostic messages to stdout -- while the postinst does call db_stop, debconf does not restore stdout, so messages to stdout disappear. This script is run after the scripts in /etc/kernel/postrm.d directory. preinst_hook DEPRECATED: Set this variable to a script to be executed before the package is unpacked, and can be used to put in additional checks. The path can be a relative path if the script lives in a safe path -- that is, if it lives in /bin, /sbin, /usr/bin, or /usr/sbin, or must be an absolute path instead. The environment variable KERNEL_PACKAGE_VERSION shall be set to the version of the kernel-package that created the package. This script shall be called with two arguments, the first being the version of the kernel image, and the second argument being the location of the kernel image itself. This script is run after the scripts in /etc/ker- nel/preinst.d directory. prerm_hook DEPRECATED: Set this variable to a script to be executed before the package files are removed (so any added files may be removed) . The path can be a relative path if the script lives in a safe path -- that is, if it lives in /bin, /sbin, /usr/bin, or /usr/sbin, or must be an absolute path instead. The environment variable KERNEL_PACKAGE_VERSION shall be set to the version of the kernel-pack- age that created the package. This script shall be called with two arguments, the first being the version of the kernel image, and the second argument being the location of the kernel image itself. Errors in the script shall cause the prerm to fail. Since debconf is in use before the script is called, this script should issue no diagnostic messages to stdout -- while the postinst does call db_stop, debconf does not restore stdout, so messages to stdout disappear. This script is run after the scripts in /etc/ker- nel/prerm.d directory. src_postinst_hook DEPRECATED: Unlike the other hook variables, this is meant for a script run during the post inst of a docs, headers or a source package. Using this hook for the headers package is now being deprecated, at some point the headers post install script shall only run the header_postinst_hook. The path can be a relative path if the script lives in a safe path -- that is, if it lives in /bin, /sbin, /usr/bin, or /usr/sbin, or must be an absolute path instead. The environment variable KERNEL_PACKAGE_VERSION shall be set to the version of the kernel-package that created the package. This script shall be called with two arguments, the first being the name of the package being installed (could be kernel source or headers), and the second argument being the version of the package being installed. Errors in the script shall cause the postinst to fail. This script is run after the scripts in /etc/ker- nel/src_postinst.d directory. header_postinst_hook DEPRECATED: Unlike the other hook variables, this is meant for a script run during the post inst of a headers package only. The path can be a relative path if the script lives in a safe path -- that is, if it lives in /bin, /sbin, /usr/bin, or /usr/sbin, or must be an absolute path instead. The environment variable KERNEL_PACKAGE_VERSION shall be set to the version of the kernel-package that created the package. This script shall be called with two arguments, the first being the name of the package being installed, and the second argument being the version of the package being installed. Errors in the script shall cause the postinst to fail. This script is run after the scripts in /etc/kernel/header_postinst.d directory. clobber_modules If set, the preinst shall silently try to move /lib/modules/version out of the way if it is the same version as the image being installed. Use at your own risk. This variable is unset by default. warn_reboot This variable can be used to turn off the warning given when installing a kernel image which is the same version as the currently running version. If the modules list is changed, the modules dependencies may have been changed, and the modules for the new kernel may not run correctly on the running kernel if the kernel ABI has changed in the meanwhile. It is a good idea to reboot, and this is a note to remind you. If you know what you are doing, you can set this variable to no. This variable is set by default. relink_build_link This option manipulates the build link created by recent kernels. If the link is a dangling link, and if a the corresponding kernel headers appear to have been installed on the system, a new symlink shall be created to point to them. The default is to relink the build link (YES). force_build_link This option manipulates the build link created by recent kernels. If the link is a dangling link, a new symlink shall be created to point to kernel headers data in /usr/src, whether they have been installed or not. The default is unset, we don't create potentially dangling symlinks by default. relink_src_link This option manipulates the source link created by recent kernels. If the link is a dangling link it is deleted at install time. The default is to relink (delete) the source link (YES). silent_modules This option has been put in for the people who are vastly irritated on being warned about preexisting modules directory /lib/mod- ules/$version. That directory may belong to an old or defunct kernel image package, in which case problems may arise with leftover modules in that directory tree, or the directory may legitimately exist due to a independent modules package being installed for this kernel version that has already been unpacked. In this latter case the existence of the directory is benign. If you set this variable, you shall no longer be given a chance to abort if a preexisting modules directory /lib/modules/$version is detected. This is unset by default. ignore_depmod_err If set, does not prompt to continue after a depmod problem in the postinstall script. This facilitates automated installs, though it may mask a problem with the kernel image. A diagnostic is still issued. This is unset be default. FILES
The file described here is /etc/kernel-img.conf. SEE ALSO
make(1), make-kpkg(1), kernel-pkg.conf(5), The GNU Make manual BUGS
There are no bugs. Any resemblance thereof is delirium. Really. AUTHOR
This manual page was written by Manoj Srivastava <srivasta@debian.org>, for the Debian GNU/Linux system. Debian Aug 20 2009 KERNEL-IMG.CONF(5)
All times are GMT -4. The time now is 11:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy