Aller au contenu
View in the app

A better way to browse. Learn more.

Next

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Shell / Bash] unary operator expected

Featured Replies

Posté(e)

Bonjour, j'ai un probleme avec un script.

Ce dernier est censé agir suivant les arguments passés.

Mais il se pose un probleme avec les argument qui engendre un regard sur le paramêtre suivant. Exemple -f doit être suivit d'un nom de fichier... La manière dont je prend le probleme est exposé à la suite.

#!/bin/sh

for I in $*; do
if [ $ENTREE -eq 1 ]; then
ENTREE_F=$I
ENTREE=2
continue
fi

if [ $RECH -eq 1 ]; then
RECH_T=$I
RECH=2
continue
fi

if [ $AUT -eq 1 ]; then
AUT_N=$I
AUT=2
continue
fi

if [ $I == -f ]; then
ENTREE=1
continue
fi

if [ $I == -affichage ]; then
AFF=2
continue
fi

if [ $I == -affichage_texte ]; then
AFF_TXT=2
continue
fi

if [ $I == -recherche ]; then
RECH=1
continue
fi

if [ $I == -auteur ]; then
AUT=1
continue
fi
done

echo ENTREE=$ENTREE ENT_F=$ENTREE_F AFF=$AFF AFF_TXT=$AFF_TXT RECH=$RECH RECH_T=$RECH_T AUT=$AUT AUT_N=$AUT_N

Mais lorsque je l'execute, j'ai un erreur me disant "unary operator expected" ligne 4, 9 et 14, respectivement : if [ $ENTREE -eq 1 ] ; then, if [ $RECH -eq 1 ] ; then et if [ $AUT -eq 1 ] ; then.

Est-ce que quelqu'un peut m'aider ? Merci.

Posté(e)

Il faut définit tes variables avant de faire la comparaison.

Si la variable est vide,

	if [ $ENTREE -eq 1 ]; then

sera remplacée par

	if [  -eq 1 ]; then

Archivé

Ce sujet est désormais archivé et ne peut plus recevoir de nouvelles réponses.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.