INSERT INTO script( name, checkumask)VALUES( 'test2', 'CurrentUmask=`grep $name /etc/profile | awk -F" " '{print $2}'`')应该是 '{print $2}' 这里的问题,在不改动CurrentUmask=`grep $name /etc/profile | awk -F" " '{print $2}'`的情况下应该怎么添加到Mysql里面
谢谢

解决方案 »

  1.   

    INSERT INTO script( name, checkumask)VALUES( 'test2', 'CurrentUmask=`grep $name /etc/profile | awk -F" " \'{print $2}\'`')单引号需要转义一下 \'
      

  2.   

    greatzhangq (greatzhangq)
      '截至2010-08-01 19:07:47  用户结帖率0.00%当您的问题得到解答后请及时结贴.
    http://topic.csdn.net/u/20090501/15/7548d251-aec2-4975-a9bf-ca09a5551ba5.html
    http://topic.csdn.net/u/20100428/09/BC9E0908-F250-42A6-8765-B50A82FE186A.html
    http://topic.csdn.net/u/20100626/09/f35a4763-4b59-49c3-8061-d48fdbc29561.html8、如何给分和结贴?
    http://community.csdn.net/Help/HelpCenter.htm#结帖
      

  3.   

    [code=SQL]mysql> INSERT INTO script( name, checkumask)VALUES( 'test2', 'CurrentUmask=grep $name /etc/profile | awk -F" " ''{print $2}''');mysql> select * from script;
    +-------+---------------------------------------------------------------+
    | name  | checkumask                                                    |
    +-------+---------------------------------------------------------------+
    | test2 | CurrentUmask=grep $name /etc/profile | awk -F" " '{print $2}' |
    +-------+---------------------------------------------------------------+
    mysql> INSERT INTO script( name, checkumask)VALUES( 'test2', 'CurrentUmask=`grep $name /etc/profile | awk -F" " \'{print $2}\'`');
    mysql> select * from script;[/code]
    +-------+-----------------------------------------------------------------+
    | name  | checkumask                                                      |
    +-------+-----------------------------------------------------------------+
    | test2 | CurrentUmask=`grep $name /etc/profile | awk -F" " '{print $2}'` |
    +-------+-----------------------------------------------------------------+
      

  4.   

    mysql> INSERT INTO script( name, checkumask)VALUES( 'test2', 'CurrentUmask=grep $name /etc/profile | awk -F" " ''{print $2}''');mysql> select * from script;+-------+---------------------------------------------------------------+
    | name | checkumask |
    +-------+---------------------------------------------------------------+
    | test2 | CurrentUmask=grep $name /etc/profile | awk -F" " '{print $2}' |
    +-------+---------------------------------------------------------------+
    mysql> INSERT INTO script( name, checkumask)VALUES( 'test2', 'CurrentUmask=`grep $name /etc/profile | awk -F" " \'{print $2}\'`');
    mysql> select * from script;
    +-------+-----------------------------------------------------------------+
    | name | checkumask |
    +-------+-----------------------------------------------------------------+
    | test2 | CurrentUmask=`grep $name /etc/profile | awk -F" " '{print $2}'` |
    +-------+-----------------------------------------------------------------+
      

  5.   


    create table script(name varchar(30),checkumask varchar(300));
    INSERT INTO script( name, checkumask)VALUES
    ( 'test2', 'CurrentUmask=`grep $name /etc/profile | awk -F" " ''{print $2}''')INSERT INTO script( name, checkumask)VALUES
    ( 'test2', 'CurrentUmask=`grep $name /etc/profile | awk -F" " \'{print $2}\'')select * from tTest