如何使用撇号为文本grep文件?

时间:2016-10-02 10:50:52

标签: linux bash command-line

people ...我正在编写一个linux bash文件,我需要它来查找文本 using System.Data; using System.Data.OleDb; using System.Web.Configuration; OleDbConnection oledbCnn=null; OleDbDataAdapter oledbAdapter = null; DataSet ds=null; string connetionString = WebConfigurationManager.ConnectionStrings["SQLServerConnectionString"].ConnectionString; string sql = "SELECT * FROM Profile ORDER BY FullName ASC"; try { oledbCnn = new OleDbConnection(connetionString); oledbCnn.Open(); oledbAdapter = new OleDbDataAdapter(sql, oledbCnn); ds = new DataSet(); oledbAdapter.Fill(ds, "Profile"); foreach (DataRow row in ds.Tables["Profile"].Rows) { Response.Write("Employee: " + " " + row["FullName"].ToString() + " " + row["Academy"].ToString() + "<p>"); } oledbCnn.Close(); } catch (Exception ex) { Response.Write("Can not open connection ! "); } finally { if (oledbCnn != null) oledbCnn.Dispose(); if (oledbAdapter != null) oledbAdapter.Dispose(); if (ds != null) ds.Dispose(); } 。有没有办法忽略那些撇号?继承人我试过的: (Josh设为'Josh''1234,1234设为usr。)

pas

1 个答案:

答案 0 :(得分:1)

只引用双引号,以便正常包含单引号:

grep "'$usr''$pas"
#    ^           ^
#     ^    ^^
#     single quotes to match