bash - How do you use shell script variables as arguments to sed? -


What I would like to do, is as follows:

  #! / Bin / Sh EMAIL = "- E / s / Something // g" "some orders | But" $ EMAIL " 

But I get the following:

  sed: -e expression # 1, char 2: unknown command: `''  

I have tried many forms I know that the string is correctly cited The reason for doing this is because I want to break the long-term command up for readability. Do I use a script-file instead (with the -f option) instead

UPDATE:

My actual script is a bit more complicated:

  #! / Bin / sh EMAIL = "- es / some things // gee / some things // live ..." some orders | but "$ EMAIL"  

after removing the same quotation marks :

  sed: -e expression # 1, character 18: unknown option `` For this type of quoted problem, eval is almost always solution.  
< / Div>

 #! / Bin / sh SED_ARG = "- e / s / something something // g" "echo something. For example, "$ SED_ARG" 

It is happening that in your edition, Shell is applying the cell with an argument ("string" -e / SOMETHING // g "") But you want to be implemented with two arguments ("-e" and "/ / SOMETHING // g"). Eval Shell is the reason for interpreting the string as you want.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -