3

in my linux machine red-hat 5.1 - in ppp file - I have only the signature.pl string !!!

  • remark - third application write the signature.pl string in to ppp file

I set ppp file in $a param And compare $a with signature.pl

But as all see here this not equal - why ? or if I have empty space? How to solve this?

    # more /var/tmp/ppp
    signature.pl
    # a=`cat /var/tmp/ppp`
    # echo $a
    signature.pl
    # [[ $a = signature.pl ]] && echo equal

or

    # [[ $a == signature.pl ]] && echo equal

diff example that works ! - from ksh shell (LINUX RED-HAT 5.1)

[u@h w]# echo signature.sh > file
[u@h w]# cat file
signature.sh
[u@h w]# a=`cat file`  
[u@h w]# echo $a
signature.sh
[u@h w]# [[ $a = signature.sh ]] && echo eq

 its print "eq"
HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
Eytan
  • 611
  • 6
  • 13
  • 27
  • Your "real" example compares `signature.sh` and `signature.pl`...they aren't the same. – Mark Wagner Feb 05 '12 at 03:16
  • this is a nother example (I fix it), on both they have the same ishhu – Eytan Feb 05 '12 at 04:46
  • It works for me. What does this tell you? `echo "${.sh.version}"` What happens if you do: `[[ $a = $a ]] && echo eq` – Dennis Williamson Feb 05 '12 at 18:26
  • yes Dennis now its work also for me I create new file in place of ppp , not clearly what was wrong , for for the first case the original question I still have problem - third application write the signature.pl string in to ppp file so I cant say what wrong here in the ppp file by vi I see only this string ( I update my results on the second case ) – Eytan Feb 05 '12 at 21:09
  • Run `/var/tmp/ppp` through `od -c` - it might contain some unprintables. – Henk Langeveld May 03 '13 at 23:48

1 Answers1

3

You need two equal signs:

[[ $a == signature.pl ]] && echo equal
Rob Wouters
  • 1,927
  • 1
  • 11
  • 4