Besoin de traduction
Fermé
john
-
14 janv. 2008 à 18:10
Phasme Messages postés 16 Date d'inscription lundi 7 janvier 2008 Statut Membre Dernière intervention 16 janvier 2015 - 14 janv. 2008 à 19:21
Phasme Messages postés 16 Date d'inscription lundi 7 janvier 2008 Statut Membre Dernière intervention 16 janvier 2015 - 14 janv. 2008 à 19:21
A voir également:
- Besoin de traduction
- Traduction photo gratuit - Guide
- La bible traduction intégrale hébreu-français pdf - Télécharger - Vie quotidienne
- Google traduction français arabe - Télécharger - Traduction
- Traduction de phrase en français vers le créole martiniquais ✓ - Forum Loisirs / Divertissements
- Traduction page google - Guide
7 réponses
jipicy
Messages postés
40842
Date d'inscription
jeudi 28 août 2003
Statut
Modérateur
Dernière intervention
10 août 2020
4 896
14 janv. 2008 à 18:12
14 janv. 2008 à 18:12
Salut,
Quel langage ?
On peut voir le contenu de ton script ?
Quel langage ?
On peut voir le contenu de ton script ?
#!bin/bash
# Program 'usern' - takes 1 argument being a file (az)
# Read the input file and look for occurrences of the current user who is executing the script.
# On finding an occurrence of the username take that line and append it to a file (test)
# and display a line number and a bracket against the saved line.
# create a file or overwrite it if it already exist
# verify if input is not null
length=$(echo -n $1 | wc -c)
if [ $length -eq 0 ]
then
# parameters missing
echo "Sorry but you must write a parameter"
exit 0
fi
>test
cpt=1 #counter
for occurrence in $(grep -E '^(PWD|USER|MAIL|LOGNAME|HOME)' $1)
do
echo "$cpt) $occurrence" >> test
cpt=$((cpt+1))
done
# Program 'usern' - takes 1 argument being a file (az)
# Read the input file and look for occurrences of the current user who is executing the script.
# On finding an occurrence of the username take that line and append it to a file (test)
# and display a line number and a bracket against the saved line.
# create a file or overwrite it if it already exist
# verify if input is not null
length=$(echo -n $1 | wc -c)
if [ $length -eq 0 ]
then
# parameters missing
echo "Sorry but you must write a parameter"
exit 0
fi
>test
cpt=1 #counter
for occurrence in $(grep -E '^(PWD|USER|MAIL|LOGNAME|HOME)' $1)
do
echo "$cpt) $occurrence" >> test
cpt=$((cpt+1))
done
jipicy
Messages postés
40842
Date d'inscription
jeudi 28 août 2003
Statut
Modérateur
Dernière intervention
10 août 2020
4 896
14 janv. 2008 à 18:25
14 janv. 2008 à 18:25
Ben déjà rajoute un "/" à "#!bin/bash" => "#!/bin/bash"
Désolé, je me suis trompé de script :(
Voici le bon :
#! /bin/bash
# verify if parameter exist
length=$(echo -n $1 | wc -c)
if [ $length -eq 0 ]
then
# parameters missing
echo "Sorry but you must write a parameter"
exit 0
fi
var=$(ls -l "$1" | cut -d" " -f1)
varUser=$(echo "$var" | cut -c2-4)
varGroupe=$(echo "$var" | cut -c5-7)
varOthers=$(echo "$var" | cut -c8-10)
userName=$(ls -l $1 | cut -d ' ' -f3)
owner="OWNER"
group="GROUP\t\t\t"
others="OTHER\t\t\t"
# put separate rights in a file - test
echo -e "$varUser\n$varGroupe\n$varOthers" > test
# display title
echo -e "\t\t\t\tREAD\tWRITE\tEXECUTE"
i=1
while read line
do
if [ "$i" == 1 ]
then param="$owner $userName"
elif [ "$i" == 2 ]
then param=$group
else param=$others
fi
# display the right by category
case "$line" in
---) echo -e "$param\tNO \tNO \tNO "
;;
--x) echo -e "$param\tNO \tNO \tYES"
;;
-w-) echo -e "$param\tNO \tYES\tNO "
;;
-wx) echo -e "$param\tYES\tYES\tYES"
;;
r--) echo -e "$param\tYES\tNO \tNO "
;;
r-x) echo -e "$param\tYES\tNO \tYES"
;;
rw-) echo -e "$param\tYES\tYES\tNO "
;;
rwx) echo -e "$param\tYES\tYES\tYES"
;;
esac
i=$(expr $i + 1)
done < test
Qu'est-ce que je dois faire pour arranger ca ?
"The script doesn't produce any output other than the header information" JE ne comprend pas tropce que ca veut dire. Merci
Voici le bon :
#! /bin/bash
# verify if parameter exist
length=$(echo -n $1 | wc -c)
if [ $length -eq 0 ]
then
# parameters missing
echo "Sorry but you must write a parameter"
exit 0
fi
var=$(ls -l "$1" | cut -d" " -f1)
varUser=$(echo "$var" | cut -c2-4)
varGroupe=$(echo "$var" | cut -c5-7)
varOthers=$(echo "$var" | cut -c8-10)
userName=$(ls -l $1 | cut -d ' ' -f3)
owner="OWNER"
group="GROUP\t\t\t"
others="OTHER\t\t\t"
# put separate rights in a file - test
echo -e "$varUser\n$varGroupe\n$varOthers" > test
# display title
echo -e "\t\t\t\tREAD\tWRITE\tEXECUTE"
i=1
while read line
do
if [ "$i" == 1 ]
then param="$owner $userName"
elif [ "$i" == 2 ]
then param=$group
else param=$others
fi
# display the right by category
case "$line" in
---) echo -e "$param\tNO \tNO \tNO "
;;
--x) echo -e "$param\tNO \tNO \tYES"
;;
-w-) echo -e "$param\tNO \tYES\tNO "
;;
-wx) echo -e "$param\tYES\tYES\tYES"
;;
r--) echo -e "$param\tYES\tNO \tNO "
;;
r-x) echo -e "$param\tYES\tNO \tYES"
;;
rw-) echo -e "$param\tYES\tYES\tNO "
;;
rwx) echo -e "$param\tYES\tYES\tYES"
;;
esac
i=$(expr $i + 1)
done < test
Qu'est-ce que je dois faire pour arranger ca ?
"The script doesn't produce any output other than the header information" JE ne comprend pas tropce que ca veut dire. Merci
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
jipicy
Messages postés
40842
Date d'inscription
jeudi 28 août 2003
Statut
Modérateur
Dernière intervention
10 août 2020
4 896
14 janv. 2008 à 19:15
14 janv. 2008 à 19:15
Salut simon ;-)
Ben ton script il est plein d'incohérence ! Reprend les exemples qui t'ont été donné et essayes de revoir point par point ce qui pourrait clocher ;-))
Ben ton script il est plein d'incohérence ! Reprend les exemples qui t'ont été donné et essayes de revoir point par point ce qui pourrait clocher ;-))
Phasme
Messages postés
16
Date d'inscription
lundi 7 janvier 2008
Statut
Membre
Dernière intervention
16 janvier 2015
14 janv. 2008 à 19:21
14 janv. 2008 à 19:21
Littéralement,
"Votre script de permission ne produit aucune autre sortie que les informations d'entêtes."
Ton script est lancé par un autre programme pour voir si il fonctionne ?
"Votre script de permission ne produit aucune autre sortie que les informations d'entêtes."
Ton script est lancé par un autre programme pour voir si il fonctionne ?