Sponsored Content
Top Forums Shell Programming and Scripting String comparision not working Post 302514616 by ahamed101 on Sunday 17th of April 2011 04:38:33 AM
Old 04-17-2011
You should have a "space" in the if clause

Code:
if [ $i == "ls.sh" ] 
then
  echo "Doing something"
fi

regards,
Ahamed
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

String comparision in shell scripting

Hi Guys, I am new to scripting I have written a code to compare strings,but I am getting some Exception Code snippet: MODE="D" if ]; then . $file1 fi Error: ./BatchJobs.sh: [[: execute permission denied I have given all Execute permissions to the script(chmod 755... (2 Replies)
Discussion started by: Anji
2 Replies

2. UNIX for Dummies Questions & Answers

problem in string comparision

Hi All, I've to compare the number of records present in a file against its trailer count. for ex: rec_cnt=$(awk 'END{print NR}' file.txt) trl_cnt=$(tail -1 file.txt| cut -c1-6) problem is trailer is appended with zero's and while comparing it is giving problem. i.e, rec_cnt=9 and... (1 Reply)
Discussion started by: ganapati
1 Replies

3. Shell Programming and Scripting

comparision of string in various files

i want to take position 19-24(only first line) from all files and need to compare any duplication is there or not. If duplication, then i have to print the file names. I have written to take the characters from 19-24 from all files. but how to compare ? ... (1 Reply)
Discussion started by: senthil_is
1 Replies

4. Shell Programming and Scripting

reg String comparision

Hi, I would like to compare the 25th position of the file with the character '(' and if it is not equal then it would generate a mail. I have used the below if condition, however it is always executing the code within if, even the comparison is expected to return false. if Please help me... (1 Reply)
Discussion started by: kdheepan
1 Replies

5. Shell Programming and Scripting

Date - String comparision

Hi, I am having difficulty to compare a string in a file against a date from a a table and print the latest date. Below are the values. String in File : 2009-12-02 00:37:51 Value Table : 2010-01-10-02.00.49.294758 I have to compare both the values ( Ignore the Microsecond in the table... (5 Replies)
Discussion started by: sam_78_nyc
5 Replies

6. Shell Programming and Scripting

String comparision

I have a string like ab or abc of whatever length. But i want to know whether another string ( for example, abcfghijkl, OR a<space> bcfghijkl ab<space> cfghijkl OR a<space>bcfghijkl OR ab<space> c<space> fghijkl ) starts with ab or abc... space might existing on the longer string... If so, i... (1 Reply)
Discussion started by: nram_krishna@ya
1 Replies

7. Shell Programming and Scripting

String Comparision

I want to compare two strings using awk dynamically without trimming the spaces and want to find the count of matching string. Input Strings file: File1 content (file1): " a " " a2 " File2 content (file2): " a " " a " " a2 " " b2 " " c2 "... (3 Replies)
Discussion started by: AhmedLakadkutta
3 Replies

8. Shell Programming and Scripting

awk: string followed by tab comparision

Hi all, Currently i am using if( $0~/ NOT / && $0~/ NULL /) { ................. } to check if the input record contains "NOT" and "NULL". But in some cases "NOT" and "NULL" are preceded and followed by tab. How do i find compare for these fields as well? (3 Replies)
Discussion started by: ysvsr1
3 Replies

9. Shell Programming and Scripting

Fixed width file comparision not working

when i used diff/cmp/cat -v commands i am getting the difference cmp command cmp -l file1 file2 |head -1 1300 15 10 Manually checked records. record length and data matched. diff file1 file2 3C3 <record information Manually checked records. record length and data matched.... (4 Replies)
Discussion started by: onesuri
4 Replies

10. Shell Programming and Scripting

Join not working for comparision

Hi All, I have 2 files where the first column of both the files have to be compared and if they match the first six columns of the first file to be extracted in the output file. Format of files : File1 : ${SHTEMP}NPBR5.XTR.tmp S00016678|129|7|MPF|20090106|E... (3 Replies)
Discussion started by: nua7
3 Replies
script(1)							   User Commands							 script(1)

NAME
script - make record of a terminal session SYNOPSIS
script [-a] [filename] DESCRIPTION
The script utility makes a record of everything printed on your screen. The record is written to filename. If no file name is given, the record is saved in the file typescript. See WARNINGS. The script command forks and creates a sub-shell, according to the value of $SHELL, and records the text from this session. The script ends when the forked shell exits or when Control-d is typed. OPTIONS
The following option is supported: -a Appends the session record to filename, rather than overwriting it. NOTES
script places everything that appears on the screen in filename, including prompts. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |CSI |Enabled | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5) WARNINGS
script can pose a security risk when used in directories that are writable by other users (for example, /tmp), especially when run by a privileged user, that is, root. Be sure that typescript is not a link before running script. SunOS 5.11 30 Jan 2004 script(1)
All times are GMT -4. The time now is 11:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy