Skip to main content
edited tags
Link
Gilles 'SO- stop being evil'
  • 865.4k
  • 205
  • 1.8k
  • 2.3k

Comparing Stringsstrings with special characters using if-loop does not workingwork

I want to compare each linesline of a particular file with the following string

#orb_plugins = ["local_log_stream", "iiop_profile", "giop", "iiop"];

("file.txt" contains this particular line)

I tried the following by prefixing special characters with ''

IFS=''
while read -r line
do
  if [ "$line" == "#orb_plugins = \[\"local_log_stream\", \"iiop_profile\", \"giop\", \"iiop\"\];" ]
  then
    echo "String found. Do remaining steps"
  fi
done < file.txt

Comparing Strings with special characters using if not working

I want to compare each lines of a particular file with the following string

#orb_plugins = ["local_log_stream", "iiop_profile", "giop", "iiop"];

("file.txt" contains this particular line)

I tried the following by prefixing special characters with ''

IFS=''
while read -r line
do
  if [ "$line" == "#orb_plugins = \[\"local_log_stream\", \"iiop_profile\", \"giop\", \"iiop\"\];" ]
  then
    echo "String found. Do remaining steps"
  fi
done < file.txt

Comparing strings with special characters using if-loop does not work

I want to compare each line of a particular file with the following string

#orb_plugins = ["local_log_stream", "iiop_profile", "giop", "iiop"];

("file.txt" contains this particular line)

I tried the following by prefixing special characters with ''

IFS=''
while read -r line
do
  if [ "$line" == "#orb_plugins = \[\"local_log_stream\", \"iiop_profile\", \"giop\", \"iiop\"\];" ]
  then
    echo "String found. Do remaining steps"
  fi
done < file.txt
Source Link

Comparing Strings with special characters using if not working

I want to compare each lines of a particular file with the following string

#orb_plugins = ["local_log_stream", "iiop_profile", "giop", "iiop"];

("file.txt" contains this particular line)

I tried the following by prefixing special characters with ''

IFS=''
while read -r line
do
  if [ "$line" == "#orb_plugins = \[\"local_log_stream\", \"iiop_profile\", \"giop\", \"iiop\"\];" ]
  then
    echo "String found. Do remaining steps"
  fi
done < file.txt