Bash无法在服务器上找到makepkg

时间:2017-11-16 23:11:22

标签: linux bash archlinux pacman-package-manager

我目前遇到的问题是我无法在服务器上使用makepkg。

我已经验证pacman已正确安装,因此我假设这必须与我的环境PATH有关?

尝试从我的bash提示符运行makepkg我得到

#include <iostream>
#include <string.h>

using namespace std;
//functions
string getFirstName();
string getLastName();
int getScores();
double calculateSum(double sum, double score);
double calculateAvg(double avg, double sum);
char calculateGrade(double score, char grade);
void displayResults(string firstname, string lastname, double avg, char 
grade);

int main(){
//variables
string firstname;
string lastname;
int score;
double sum;
double avg;
char grade;
//functions and parameters
firstname = getFirstName();
lastname = getLastName();
score = getScores();
sum = calculateSum(sum, score);
avg = calculateAvg(avg, sum);
grade = calculateGrade(score, grade);
displayResults(firstname,lastname,avg,grade);


while (true)
{
firstname = getFirstName();
cin >> firstname; 
if (firstname == "done")break;
lastname = getLastName();
cin >> lastname;
sum=0.0;

  for (int i = 0; i<10; i++)
    {
        double score;
     cin >> score;
     sum - calculateSum(sum, score);
      sum+=score;
      //sum = sum+score;
    }
     avg = calculateAvg(avg, sum);
  avg = sum/10.0;
    displayResults(firstname,lastname,avg,grade);
 }
return 0; 
}

string getFirstName()
{
string firstname;
cout<<"Enter first name: " << endl;
cin >>firstname;
return firstname;
}

string getLastName()
{
string lastname;
cout<<"Enter last name: ";
cin >>lastname;
return lastname;
}

int getScores()
{
int score;
cout <<"Input score: ";
cin >>score;
return score;
}

double calculateSum(double sum, double score)
{
sum+=score;
return sum;
}

double calculateAvg(double avg, double sum)
{
avg = sum/10.0;
return avg;
}

char calculateGrade(double score, char grade)
{

if (score >= 90) 
grade = 'A';
else if (score >=80) 
grade = 'B';
else if (score >=70)
grade = 'C';
else if (score >=60) 
grade = 'D';
else 
grade = 'F';
return grade;
}


void displayResults(string firstname, string lastname, double avg, char 
grade)
{
cout<<firstname<< lastname<<": "<<avg << grade;
}

2 个答案:

答案 0 :(得分:0)

嗯,你需要正确的命令路径...... 在$ PATH中尝试exec echo并尝试将path命令导出到$ PATH。

export PATH=$PATH:/path/of/command

答案 1 :(得分:0)

尝试重新安装pacman,如下所示:sudo pacman -S pacman