Bash: permission denied
Hello, my name is Jean Désiré
I have the Linux Ubuntu OS, and for the past two days, I have been unable to run my programs. There is no issue with compilation, but when I try to execute them, I get this message: "bash: permission denied"
I switch to root and still get the same result. Any help would be welcome. Thank you
Configuration: Windows 7 / Safari 534.10
I have the Linux Ubuntu OS, and for the past two days, I have been unable to run my programs. There is no issue with compilation, but when I try to execute them, I get this message: "bash: permission denied"
I switch to root and still get the same result. Any help would be welcome. Thank you
Configuration: Windows 7 / Safari 534.10
2 answers
-
Normally, just after compilation, a
/NomProg
is enough to execute the program
but if not, think about allowing the execution of this program file
either right-click -> properties -> permissions -> check the box "make this file executable" (or something like that)
or by using the chmod commandsudo chmod +x NomProg
and read this
http://doc.ubuntu-fr.org/permissions
http://doc.ubuntu-fr.org/droits-
-
Hi,
Take the time to check if he has execution rights.
Otherwise, you can always share your program or its sources to see if someone can do something with it, but I believe it's a problem with execution rights.
Catch you later :- )
Edit: Also check if you are the owner of the file, because if you tried to run it as root, that might have changed the owner. -
-
Thank you for all your suggestions, but the problem persists, so here is the code:
#include<stdio.h>
char* result;
char* Replace(char* dez) { int k;
char* T[4]; T[0] = "Monday";
T[1] ="Tuesday";
T[2] ="Wednesday";
T[3] ="Thursday";
char* H[4];H[0]="7 PM";
H[1]="8 PM";
H[2]="9 PM";
H[3]="10 PM";
char* C[4]; C[0]="France4";C[1]="Madagascar4"; C[2]= "Quebec3";C[3]="Senegal6";
/* line 23 */ for (k=0;k<=4;k++){if(dez==T[k]) result=T[k+1];
else if (dez==H[k]) result=H[k+1];
else if (dez==C[4]) result=C[k+1];
else k++; }
return result ; // line 30
}
int main(){
/* Declaration of variables */
char* alize[4]; char* xorg[4];char* pamela[4]; char* wolverine[4];
char* lillekim[4]; char* mystique[4];
int i,j,fin; fin=0;
/* initialization of variables */
alize[0]="SoireeFoot"; alize[1]="Thursday"; alize[2]="7 PM"; alize[3]="France4";
xorg[0]="GMYM'Ac"; xorg[1]="Tuesday"; xorg[2]="7 PM"; xorg[3]="Madagascar4";
pamela[0]="VMV"; pamela[1]="Monday"; pamela[2]="8 PM"; pamela[3]="France4";
wolverine[0]="BOBOBO"; wolverine[1]="Tuesday"; wolverine[2]="10 PM"; wolverine[3]="Senegal6";
lillekim[0]="GMYM'Ac"; lillekim[1]="Wednesday"; lillekim[2]="7 PM"; lillekim[3]="France4";
mystique[0]="SoireeFoot"; mystique[1]="Thursday"; mystique[2]="9 PM"; mystique[3]="Madagascar4";
while(fin=0) { if ( (alize[0]==lillekim[0])||(alize[0]==mystique[0]))
for (j=1; j<=4;j++) if ((alize[j]==lillekim[j])||(alize[j]==mystique[j])) { Replace(alize[j]);alize[0]="seen";}
else if ((xorg[0]==lillekim[0])||(xorg[0]==mystique[0]))
for (j=1; j<=4;j++) if ((xorg[j]==lillekim[j])||(xorg[j]==mystique[j])) { Replace(xorg[j]);xorg[0]="seen";}
else
fin=1 ;
}
for (i=1;i<=4;i++) if ((pamela[i]==alize[i])|| (pamela[i]==xorg[i])) Replace(pamela[i]);
for (i=1;i<=4;i++) if((wolverine[i]==alize[i])||(wolverine[i]==xorg[i])|| (wolverine[i]==pamela[i])) Replace(wolverine[j]);
alize[0]="SoireeFoot"; xorg[0]="GMYM'AC";
printf("\n %s %s %s %s",alize[0],xorg[0],pamela[0],wolverine[0]);
printf("\n %s %s %s %s",alize[1],xorg[1],pamela[1],wolverine[1]);
printf("\n %s %s %s %s",alize[2],xorg[2],pamela[2],wolverine[2]);
printf("\n %s %s %s %s",alize[3],xorg[3],pamela[3],wolverine[3]);
return(1);
} -
When executing your code, there is a segmentation fault https://fr.wikipedia.org/wiki/Erreur_de_segmentation in addition to the following warning at compilation <code>test.c:55: warning: suggest parentheses around assignment used as truth value
(I am using Geany)
So at line 55; I changed the assignment to equality test and there are no more warnings or execution errors
while(fin==0)
and have a Good EveningFootball !!!!
-