Bonsoir à tous,

j'ai un souci de script bash exécuté par cron

voici un example pour tester :

voici ma ligne cron :
*/1 * * * *     root    /etc/scripts/test.sh
(cela me donne de temps de changer en live la partie qui "merdouille" ....)
voici mon script :
#!/bin/sh
#Array=([1]=filemgr-all [2]=newsletter [3]=phpmyadmin [4]=roundcubemail [5]=tracker [6]=calendrier [7]=ipplan [8]=dspam [9]=postfix [10]=spam)
Array[1]='filemgr-all'
Array[2]='newsletter'
Array[3]='phpmyadmin'
Array[4]='roundcubemail'
Array[5]='tracker'
Array[6]='calendrier'
Array[7]='ipplan'
Array[8]='dspam'
Array[9]='postfix'
Array[10]='spam'
NbElement=${#Array[*]}
echo $NbElement
echo ${Array[10]}

le retour par mail de mon script:
#!/bin/sh
#declare -a Array=([1]=filemgr-all [2]=newsletter [3]=phpmyadmin [4]=roundcubemail [5]=tracker [6]=calendrier [7]=ipplan [8]=dspam [9]=postfix [10]=spam)
Array[1]='filemgr-all'
Array[2]='newsletter'
Array[3]='phpmyadmin'
Array[4]='roundcubemail'
Array[5]='tracker'
Array[6]='calendrier'
Array[7]='ipplan'
Array[8]='dspam'
Array[9]='postfix'
Array[10]='spam'
NbElement=${#Array[*]}
echo $NbElement
echo ${Array[10]}

ce que j obtiens lorsque j'exécute à la main
./test.sh
 10
spam

version de mon bash :
 => bash --version
GNU bash, version 4.1.2(1)-release (i486-pc-linux-gnu)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

version de ma debian :
 cat /etc/debian_version
squeeze/si

merci de votre aide

philippe




--
Lisez la FAQ de la liste avant de poser une question :
http://wiki.debian.org/fr/FrenchLists

Pour vous DESABONNER, envoyez un message avec comme objet "unsubscribe"
vers debian-user-french-requ...@lists.debian.org
En cas de soucis, contactez EN ANGLAIS listmas...@lists.debian.org
Archive: http://lists.debian.org/4bae470b.5060...@worm-fr.com

Répondre à