Précédent   Forum des professionnels en informatique > Systèmes > Linux > Applications > Shell
Shell Vos questions sur l'utilisation des commandes shell
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 24/01/2008, 18h41   #1
Membre émérite
 
Inscription : novembre 2007
Messages : 553
Détails du profil
Informations forums :
Inscription : novembre 2007
Messages : 553
Points : 876
Points : 876
Par défaut script awk permission refusée

J'essaye d'écrire un script awk. J'ai mis #!/usr/bin/awk -f au début de mon fichier.
J'obtiens l'erreur suivante:
Code :
bash: ./rpt2mat : /usr/bin/awk : mauvais interpréteur: Permission non accordée
, alors que je peux utiliser awk en ligne de commande.
vinc-mai est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 24/01/2008, 19h29   #2
Membre expérimenté
 
Avatar de Pilru
 
Homme
Dev ASP.NET/jQuery ; Admin ORACLE
Inscription : septembre 2007
Messages : 418
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Dev ASP.NET/jQuery ; Admin ORACLE

Informations forums :
Inscription : septembre 2007
Messages : 418
Points : 531
Points : 531
Normal. awk est un langage de script, pas un interpreteur de commande comme bash.

Essayes plutôt :

Code :
1
2
3
4
 
#!/usr/bin/sh
 
awk -f fichierscript
man awk pour plus d'infos.
Pilru est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 24/01/2008, 22h13   #3
Membre émérite
 
Inscription : novembre 2007
Messages : 553
Détails du profil
Informations forums :
Inscription : novembre 2007
Messages : 553
Points : 876
Points : 876
Citation:
Envoyé par http://www.gnu.org/software/gawk/manual/gawk.html
1.1.4 Executable awk Programs

Once you have learned awk, you may want to write self-contained awk scripts, using the `#!' script mechanism. You can do this on many Unix systems7 as well as on the GNU system. For example, you could update the file advice to look like this:

#! /bin/awk -f

BEGIN { print "Don't Panic!" }

After making this file executable (with the chmod utility), simply type `advice' at the shell and the system arranges to run awk8 as if you had typed `awk -f advice':

$ chmod +x advice
$ advice
-| Don't Panic!

(We assume you have the current directory in your shell's search path variable (typically $PATH). If not, you may need to type `./advice' at the shell.)

Self-contained awk scripts are useful when you want to write a program that users can invoke without their having to know that the program is written in awk.
vinc-mai est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 24/01/2008, 23h54   #4
Membre expérimenté
 
Avatar de Pilru
 
Homme
Dev ASP.NET/jQuery ; Admin ORACLE
Inscription : septembre 2007
Messages : 418
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Dev ASP.NET/jQuery ; Admin ORACLE

Informations forums :
Inscription : septembre 2007
Messages : 418
Points : 531
Points : 531
Visiblement, ça ne fonctionne pas.
Pilru est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/01/2008, 10h49   #5
Membre émérite
 
Inscription : novembre 2007
Messages : 553
Détails du profil
Informations forums :
Inscription : novembre 2007
Messages : 553
Points : 876
Points : 876
J'ai essayé sur une autre machine et celà marche. Le script (écrit sur l'autre) a marché sur la mienne aussi. Il ne marche plus maintenant (je l'ai éditer entre temps sans rien changer).
vinc-mai est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 18h08.


 
 
 
 
Partenaires

Hébergement Web