Bash: Multiple condition for checking stringExcel extract substring from stringSearch recursively for a...

How can my powered armor quickly replace its ceramic plates?

Why has the mole been redefined for 2019?

What are "industrial chops"?

Equation with several exponents

Strange Sign on Lab Door

What is the wife of a henpecked husband called?

CREATE ASSEMBLY System.DirectoryServices.AccountManagement.dll without enabling TRUSTWORTHY

Why do neural networks need so many training examples to perform?

Can an insurance company drop you after receiving a bill and refusing to pay?

What is the purpose of easy combat scenarios that don't need resource expenditure?

Writing a character who is going through a civilizing process without overdoing it?

My cat mixes up the floors in my building. How can I help him?

Which one of these password policies is more secure?

How long is the D&D Starter Set campaign?

Do authors have to be politically correct in article-writing?

Am I a Rude Number?

Word or phrase for showing great skill at something WITHOUT formal training in it

Roman Numerals equation 1

Normalization for two bulk RNA-Seq samples to enable reliable fold-change estimation between genes

If I delete my router's history can my ISP still provide it to my parents?

How to deal with an incendiary email that was recalled

Why publish a research paper when a blog post or a lecture slide can have more citation count than a journal paper?

How to say "Brexit" in Latin?

Pronunciation of umlaut vowels in the history of German



Bash: Multiple condition for checking string


Excel extract substring from stringSearch recursively for a string containing whitespacesHow to search for any files that do not contain a proper XML root element?Bash history - get last command by string, containing spaceBash script, string not replaced correctly with escaped $ and & charactersDeleting entire line based off of string in powershell…and keeping the line below?How To Search for multiple multi-word strings in vim?Notepad++ macro for changing a certain part of a stringBASH - Count the number of occurrences of a substring in a stringNotepad++ Replacement String with NUL Truncates After NUL













0















I want to check whether a line of string contain a substring and not ending with semicolon.



String



string1: I like applepie;



string2: I like applepie



search string: apple



string1: true



string2: false



I have try this:



if [[ $fileline == *"$search_string"* ]] && [ $fileline == "*!;$"];



But it does not works.









share







New contributor




K. Sopheak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0















    I want to check whether a line of string contain a substring and not ending with semicolon.



    String



    string1: I like applepie;



    string2: I like applepie



    search string: apple



    string1: true



    string2: false



    I have try this:



    if [[ $fileline == *"$search_string"* ]] && [ $fileline == "*!;$"];



    But it does not works.









    share







    New contributor




    K. Sopheak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      I want to check whether a line of string contain a substring and not ending with semicolon.



      String



      string1: I like applepie;



      string2: I like applepie



      search string: apple



      string1: true



      string2: false



      I have try this:



      if [[ $fileline == *"$search_string"* ]] && [ $fileline == "*!;$"];



      But it does not works.









      share







      New contributor




      K. Sopheak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I want to check whether a line of string contain a substring and not ending with semicolon.



      String



      string1: I like applepie;



      string2: I like applepie



      search string: apple



      string1: true



      string2: false



      I have try this:



      if [[ $fileline == *"$search_string"* ]] && [ $fileline == "*!;$"];



      But it does not works.







      bash shell regex string conditional-statements





      share







      New contributor




      K. Sopheak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      K. Sopheak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      K. Sopheak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 2 mins ago









      K. SopheakK. Sopheak

      1084




      1084




      New contributor




      K. Sopheak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      K. Sopheak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      K. Sopheak is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          K. Sopheak is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1410365%2fbash-multiple-condition-for-checking-string%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          K. Sopheak is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          K. Sopheak is a new contributor. Be nice, and check out our Code of Conduct.













          K. Sopheak is a new contributor. Be nice, and check out our Code of Conduct.












          K. Sopheak is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Super User!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1410365%2fbash-multiple-condition-for-checking-string%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...

          Tribunal Administrativo e Fiscal de Mirandela Referências Menu de...

          looking for continuous Screen Capture for retroactivly reproducing errors, timeback machineRolling desktop...