Sponsored Content
Full Discussion: comparing two strings
Top Forums Shell Programming and Scripting comparing two strings Post 302247098 by infyanurag on Wednesday 15th of October 2008 02:34:40 AM
Old 10-15-2008
comparing two strings

hi All

i am facing prob in comparing two strings that have two word.
below is the code snippet.
checkValidates="file validates"
file3_name="file"
if [ $checkValidates = "$file3_name validates" ]
then
echo "file" $file3_name "is validated successfully"
fi

when i run this i get the error as -bash: [: too many arguments

am i doing something wrong?
Please help..

Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

comparing two strings

Hi How do i compare two strings in shell script. Below is an example but I am not getting the desired output, plz help if then echo success fi I am not getting the desired output if I do this. plz help (24 Replies)
Discussion started by: ragha81
24 Replies

2. UNIX for Advanced & Expert Users

Comparing strings

I have two strings a=Mar22 b=may21 how can I compare them Is this fine if then; . ... else .... fi or if then (2 Replies)
Discussion started by: yakyaj
2 Replies

3. Shell Programming and Scripting

Comparing Two Strings

Hi All, While I am trying to run below code I Am getting the exception like ./abs.sh: line 102: syntax error near unexpected token `then' ./abs.sh: line 102: ` then' The Code Snippet is: if then cat $file1 | sed -e... (8 Replies)
Discussion started by: Anji
8 Replies

4. Shell Programming and Scripting

comparing strings

i have a string in a file which gets repeated number of times like below: rpttxt("abc") . . rpttxt("REP_TITLE") rpttxt("BOS_TITLE") . . . . and so on using awk or grep how can i comapre the string( as the second half keeps varying) and store it in a temporary variable? I am using the... (3 Replies)
Discussion started by: agarwal
3 Replies

5. Shell Programming and Scripting

comparing 2 strings

hi i have 2 strings. i want to compare the strings. please help (2 Replies)
Discussion started by: satish@123
2 Replies

6. Shell Programming and Scripting

Comparing strings using nawk

Hello All Please I have got a file called DATE.tex which consist of 01-04-2008_12:00:00 01-04-2005_12:00:00 01-04-2003_12:00:00 01-04-2007_12:00:00 01-04-2002_12:00:00 01-04-2009_12:00:00 I want to use nawk to print out the dates >=01-04-2009_12:00:00 I tried this cat plnt.new |... (6 Replies)
Discussion started by: ganiel24
6 Replies

7. Shell Programming and Scripting

Comparing strings with sed

Input: The the the the Output: not-same same What would be the sed command to do this? (7 Replies)
Discussion started by: cola
7 Replies

8. UNIX for Dummies Questions & Answers

Strings comparing incorrectly

Hello I'm very new to Linux and shell scripting so I only know basic stuff. I'm making a script with the purpose of finding the longest string or word in a file. Here's what I got so far: #!/bin/bash longest="" for i in $(strings -n $1); do if ] then longest=$i fi done echo $longest... (4 Replies)
Discussion started by: SCB
4 Replies

9. Shell Programming and Scripting

comparing strings as ints

Hi, So I got his code below. $year is a string of 2010,2011 etc. I guess I want to convert $year to an integer so I can do my if statement to see if the year string is greater than 2010? Or how could I do this? Right now I get a syntax error doing this. if; then do stuff fi (2 Replies)
Discussion started by: vsekvsek
2 Replies

10. Shell Programming and Scripting

Comparing Strings in ksh88

Hi I tried the following string comparison script in Ksh88 #!/bin/ksh str1='aC' str2='ABC' if then echo "Equal" else echo "Not Equal" fi Though str1 and str2 are not equal the script output says Equal . Please correct me Thanks (2 Replies)
Discussion started by: smile689
2 Replies
dce_login(1m)															     dce_login(1m)

NAME
dce_login - Validates a principal's identity and obtains the principal's network credentials SYNOPSIS
dce_login [principal_name] [password] [-c | -k keytable] [-r] [-f | +f] [-e[xec] cmd_string] OPTIONS
Causes the principal's identity to be certified. If you do not specify -c, the principal's identity is validated only. Retrieves the authentication key from keytable. Refreshes and validates the current login ID. Enables DCE TGT to be forwardable. Disables DCE TGT to be forwardable. Executes the command supplied as cmd_string. ARGUMENTS
The name of the principal to log in as. The password for principal_name. DESCRIPTION
The dce_login command is supplied for use in DCE configuration. It validates a principal's identity and obtains the principal's network credentials. If the -c option is supplied, the command also certifies the principal's identity, and, if the principal is able to be certified, creates an entry for the principal in the machine's local registry. If the principal is not able to be certified, the command attempts to log the principal in via the local registry. The -exec option executes the command specified by cmd_string after login. If cmd_string is specified without a full pathname, the path prefix is obtained by searching the directories according to the PATH variable. If you do not supply the name of the principal to validate, either on the command line with the principal_name argument or through the -r option that retrieves the principal name from the current login context, dce_login prompts for the principal name. If you do not supply the principal's authentication key either on the command line with password argument or through the -k option that retrieves the principal authentication key from the specified keytable, dce_login prompts for the password. If you supply the principal name and password on the command line, you must specify the principal name first, followed by the password. If you supply the principal_name argument and the -r option, the named principla must be the principal of the current network identity. If you supply the -f option, the forwardable TGT attribute is then turned on for this login context. Then when forwarding a user's DCE TGT from machine A to machine B, it enables the user from machine A to reuse their Kerberos credentials on machine B. The option +f turns off the forwardable TGT attribute. -f and +f can be used in conjunction with -r to change the forwardable TGT attribute for the current login context. The dce_login command executes the shell specified in the SHELL environment variable. Note that if the clocks on the Security server and client machines are not synchronized to within 2 or 3 minutes of each other, you may receive a password validation error and be unable to be validated. dce_login(1m)
All times are GMT -4. The time now is 12:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy