找到所有文件包含linux中的字符串

时间:2016-09-04 13:38:59

标签: linux grep

如何从根级别找到所有文件包含特定字符串?

我用root& amp;尝试了类似的事情:

#include <iostream>
#include <string>
using namespace std;


class Employee
{
public :
    virtual int calculateSalary()= 0;
    virtual string getName()=0;      
    virtual string getEngineer()=0;            //error
    virtual string getManager()=0;            /error
    virtual string getDirector()=0;              /error

};

class Engineer: public Employee
{
protected:
    string name;
    int salary;
public:
    Engineer(string n,int s):name(n),salary(s){ cout<<endl<<"Engineer    Created"; }
    ~Engineer(){cout<<endl<<"engineer destroyed";}
    int calculateSalary()
    {
        return salary * 2;
    }
    string getName()
    {
        return name;
    }
    string getEngineer()
    {
        return "Engineer";
    }
};

class Manager:public Engineer
{
public:
    Manager(string n,int s): Engineer(n,s) { cout<<endl<<"Manager Created"; }
    ~Manager(){cout<<endl<<"MANAGER destroyed";}
    int calculateSalary()
    {
        return salary * 3;
    }
    string getName()
    {
        return name;
    }
    string getManager()
    {
        return "manager";
    }
};

class Director:public Manager
{
public:
    Director(string n,int s): Manager(n,s) { cout<<endl<<"Director Created"; }
    ~Director(){cout<<endl<<"Director destroyed";}
    int calculateSalary()
    {
        return salary * 4;
    }
    string getName()
    {
        return name;
    }
    string getDirector()
    {
        return "director";
    }
};

int main()
{
    Engineer e1("rohit",20000),e2("soham",21000);
    Manager m1("shyam",23000),m2("ram",23500);
    Director d1("rahul",25000);

    Employee *staff[] = {&e1,&e2,&m1,&m2,&d1};

    for(int i=0;i<5;i++)
    {
        cout<<endl<<"Name : "<<staff[i]->getName() << "\t" << "Salary : " << staff[i]->calculateSalary();
     }

    cout<<endl<<staff[0]->getEngineer();                //error
    cout<<endl<<staff[1]->getEngineer();                //error
    cout<<endl<<staff[2]->getManager();                //error
    cout<<endl<<staff[3]->getManager();                //error
    cout<<endl<<staff[4]->getDirector();                //error

    return 0;
}

我得到了几个许可被拒绝(虽然我是根)。

1 个答案:

答案 0 :(得分:0)

作为root用户,您仍然可以 <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>4.3.2.RELEASE</version> </dependency>

chmod a-r file