Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

[Q] Fichier au nom bizarre ...

3 réponses
Avatar
philippe.geneste
Bonjour,

Dans mon dossier "bin" j'ai un fichier avec l'icône du terminal qui
s'appelle " [ ".
Est-ce un nom normal ou pas ?

Voici ce que j'obtiens lorsque je demande son exécution dans le terminal
:
tcsh: /sw/bin/init.csh: No such file or directory.
[Ordinateur de truc:/bin] truc% /bin/\[; exit
[Opération terminée]logout


--
philippe.geneste@libertysurf.fr
http://zigzagmusic.webhop.net/
Collectif de Jazz

3 réponses

Avatar
Éric Lévénez
Le 5/12/03 7:32, dans
<1g5hgrw.15pv26118kv94N%, « Philippe
Geneste » a écrit :

Dans mon dossier "bin" j'ai un fichier avec l'icône du terminal qui
s'appelle " [ ".
Est-ce un nom normal ou pas ?


Oui, c'est normal, c'est l'autre nom de test.

Voici ce que j'obtiens lorsque je demande son exécution dans le terminal
:
tcsh: /sw/bin/init.csh: No such file or directory.
[Ordinateur de truc:/bin] truc% /bin/[; exit
[Opération terminée]logout


Utile un vrai shell, et pas tcsh :->

Exemples qui font la même chose en sh :

if [ $n -lt 4 ]
then
echo $n trop petit
fi

if test $n -lt 4
then
echo $n trop petit
fi

[ $n -lt 4 ] && echo $n trop petit

test $n -lt 4 && echo $n trop petit

La différence entre [ et test est que [ attend un argument en plus, le
dernier, qui doit être ]. Et donc dans une expression [ ... ] le premier
crochet est le nom du programme et le dernier est juste un argument.

--
Éric Lévénez -- <http://www.levenez.com/>
Unix is not only an OS, it's a way of life.

Avatar
philippe.geneste
Éric Lévénez wrote:

Le 5/12/03 7:32, dans
<1g5hgrw.15pv26118kv94N%, « Philippe

Dans mon dossier "bin" j'ai un fichier avec l'icône du terminal qui
s'appelle " [ ".
Est-ce un nom normal ou pas ?


Oui, c'est normal, c'est l'autre nom de test.


Et que teste-t-il ?

...

J'ai pas tout compris mais merci quand même


--

http://zigzagmusic.webhop.net/
Collectif de Jazz


Avatar
Éric Lévénez
Le 5/12/03 8:03, dans
<1g5hibq.bv0cn415bz6kkN%, « Philippe
Geneste » a écrit :

Éric Lévénez wrote:

Le 5/12/03 7:32, dans
<1g5hgrw.15pv26118kv94N%, « Philippe

Dans mon dossier "bin" j'ai un fichier avec l'icône du terminal qui
s'appelle " [ ".
Est-ce un nom normal ou pas ?


Oui, c'est normal, c'est l'autre nom de test.


Et que teste-t-il ?


Si tu veux bidouiller dans le terminal, il serait bon d'apprendre à utiliser
le manuel aka man. Dans ton cas : "man test"

Avec test on peut tester des propriétés de fichiers (accès...) et des
chaînes de caractères (égalité...).

--
Éric Lévénez -- <http://www.levenez.com/>
Unix is not only an OS, it's a way of life.