shell_non_interactif.sh
· 403 B · Bash
Raw
if [[ $- == *i* ]]; then
# action réservé à un shell interactif
cat machin.bidule
fi
# ou placer ce qui suis au début du .bashrc de façon a interrompre le chargement de bashrc si le script n'est pas interactif.
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
#ou
if [[ ! $- == *i* ]]; then
# si le shell n'est pas interactif
return 0
fi
| 1 | if [[ $- == *i* ]]; then |
| 2 | # action réservé à un shell interactif |
| 3 | cat machin.bidule |
| 4 | fi |
| 5 | |
| 6 | # ou placer ce qui suis au début du .bashrc de façon a interrompre le chargement de bashrc si le script n'est pas interactif. |
| 7 | |
| 8 | # If not running interactively, don't do anything |
| 9 | case $- in |
| 10 | *i*) ;; |
| 11 | *) return;; |
| 12 | esac |
| 13 | |
| 14 | #ou |
| 15 | |
| 16 | if [[ ! $- == *i* ]]; then |
| 17 | # si le shell n'est pas interactif |
| 18 | return 0 |
| 19 | fi |
| 20 | |
| 21 |