mon code est quelque chose comme çacomment obtenir la commande d'entrée suivante basée sur la comparaison de commande précédente [bash script]
#!/bin/bash
for i in $1 $2 $3 $4; do
if [[("$i" == '-f')]] ; then #I'm searching if the user input the -f switch
if [ -f "$((i+1))" ]; then # I'm trying to increment the position of $i to get the input that follows the -f switch and check the existence of the file
echo "$((i+1)) file found"
else
echo "$((i+!)) file not found"
fi
fi
done
ma question est de savoir comment obtenir après une entrée spécifique l'entrée de l'utilisateur qui est dans mon cas -f. est-ce possible de faire dans bash scripting. un indice sur la façon de faire. Merci.
Merci. C'est très utile. Vous êtes un gars intelligent incroyable. – Muzy