Because I need it, I implement the statusBar function.
I tested with KSH and Bash and it seems to work with both.
Changelog :
+ statusBar : generate the informations to have a status bar. eg. 0%....5%....10%.... and so on until 100%
lundi 3 mai 2010
Par Flyounet le lundi 3 mai 2010, 17:58 - Outils & Développements
Because I need it, I implement the statusBar function.
I tested with KSH and Bash and it seems to work with both.
+ statusBar : generate the informations to have a status bar. eg. 0%....5%....10%.... and so on until 100%
mardi 27 avril 2010
Par Flyounet le mardi 27 avril 2010, 14:00 - Outils & Développements
Due to lots of bugs in the previous version, I'm happy to show you this one with I hope no bug inside.
Nearly all tests have been done with Ksh, and unfortunately I forget to test under Bash, and that's the result... Sorry.
> Problem with the Bash version. If old Bash is use BASH_SOURCE doesn't exist... Now looks for the files instead of trying to load it directly to avoid, error messages. Search in above and under directory. * F01Version return the path of the Bash extension. * trim : Huge bug ! Instead of unsetting __ltrim & __trim, i unsetted functions ltrim & rtrim... > ltrim & rtrim don't work under Bash ! ARGGGGGGGGGGGGG !!!!! * iniParseFile : In case of a line only containing a left var with incorrect character (like a dash -), the awk version sent an error to the output (and under Ksh stops). Function has been rewritted purely in Shell... * sprintf : Problem under Bash. Bash doesn't support only one _ as a variable name : Corrected. * iniGetValue : Not use grep anymore. Only Shell ! * fileCheck : Problem under Bash. Bash doesn't support only one _ as a variable name : Corrected. * logMe : Problem under Bash. Bash doesn't support only one _ as a variable name : Corrected. > Now only logRotate use non-shell programs ! + myError : If none args then empty __lastError
jeudi 22 avril 2010
Par Flyounet le jeudi 22 avril 2010, 21:21 - Outils & Développements
J'ai oublié de publier les précédentes versions, aussi je vous présente cette nouvelle version.
Après pas mal de boulot, il ne reste plus que la fonction iniParseFile qui continue d'utiliser awk, sinon tout le reste n'utilise plus que le Shell avec lequel il a été exécuté.
Et j'en ai profité pour passer le code sous GPLv3 et DSSL (disponible là).
v0.23 [30/01/2010] Flyounet [@Home] :
* fileCreate: In case of error during touch an ugly message is now
sent to /dev/null (for chmod too)
v0.24 [03/03/2010] Flyounet [@Home] :
> First svn version
v0.25 [01/04/2010] Flyounet [@Home] :
+ textFill: equivalent to perl "string" x number
+ textBox: put a caracter all around a text
* textBox: not working with KSH
+ _str2lower & _str2upper have been added, cause to KSH that doesn't
support Case modification of Bash.
* textBox: now use _str2*er and work with KSH
* iniGetValue: Remove the call to awk (Yeah ! Love shell !)
v0.26 [22/04/2010] Flyounet [@Home] :
+ parseHeadersForHelp: Print the headers of each function in a file.
Headers are based on a first line containing a #F??.
> textBox: Only works with KSH... Fuck !
* textBox: A subfile is needed to make it works with bash.
J'ai tenté de la rendre la plus indépendante possible de sed et awk qui sont assez incontournable[1]. Elle fonctionne sous bash ou ksh.
Ci-dessous un aperçu des variables et fonctions :

En annexes sont fournis les fichiers indépendants, ainsi qu'une archive regroupant le tout.
Les fichiers sont :
common.lib_v0.26.tar.bz2 : L'archive qui contient tous les fichiers,common.lib.README : Une micro documentation,common.lib : La librairie Shell,_common4bash.lib : L'extension pour Bash de la fonction textBox(),doc/common.lib.mm : La liste de fonctions et variables sous forme de fichier Free(Mind|Plane),doc/common.lib.png : La liste de fonctions et variables sous forme de fichier image,test/libHelp.sh : Un script de test qui retourne de l'aide sur les fonctions,test/test_common-lib.conf : Un fichier de configuration pour exécuter le script de test,test/test_common-lib.sh : Un script de test, qui exécute quasiment toutes les fonctions de la librairie.26ecc237a2dcc4f74f3a21ed3db809d6 _common4bash.lib 2c540c2a2516829a7f0796ebdc789979 common.lib 07d486cdcf8c5623a2a17b7183c0b7be common.lib.README dde7d1862448a90eaadfd8e2ee5ec811 doc/common.lib.png 606b099e82e48e846c71555b2827237a doc/common.lib.mm d04d3958e604ffdd69d5387d6c95110f test/libHelp.sh 51504fd29f5fd1aa73137d73657536ae test/test_common-lib.conf 21793fdcd0cc20cf16743e223d157a63 test/test_common-lib.sh 4cef5fce3dc9d224333540b91bd53f61 F01common.lib_v0.26.tar.bz2
123dfbdbce15d27c0d5ca8a927d5d2fe0a575b41 _common4bash.lib 72e7de48dd30ef059bc16bbd809536505de62cdf common.lib fa9dead34dbc604a49ddf15b81805d288a9a0157 common.lib.README 0acab9ac384dfb9ce9e30baa4195cd2088fc069b doc/common.lib.png d32b6a8c2ad02816031b1e2f39dde6d7f41818af doc/common.lib.mm f8f1bf4afb8e54ec122f5f6e67a8a0bba72e98c8 test/libHelp.sh 34a05abbd28321b353c34b4003b7e001afd8a1b0 test/test_common-lib.conf db07298d8710c78ca681dc4496408ee4901aa000 test/test_common-lib.sh b849101928c71eec69f7623b233f369bf0dcfd3c F01common.lib_v0.26.tar.bz2
Ci-dessous la liste des fonctions :
#F01.01.03 #Function : ps2, Print to screen string passed in argument #F01.02.02 #Function : p2st, Print to screen string passed in argument, with Time before #F01.03.01 #Function : oops, Print to screen string passed in argument, and exit 1 #F01.04.01 #Function : oopst, Print to screen string passed in argument, with time before, and exit 1 #F01.05.06 #Function : myDebug, Print to screen string passed in argument if debug level is reach #F01.06.02 #Function : myError, Store error in variables #F01.07.02 #Function : fileCheck, Check file for presence and permission #F01.08.02 #Function : fileCreate, Create file with permissions if asked #F01.09.01 #Function : fileDelete, Delete the specified file #F01.10.04 #Function : iniGetValue, Get the value from a specified INI file #F01.11.04 #Function : iniParseFile, Set all values from a specified INI file #F01.12.03 #Function : trim, Remove all blank from begining and end #F01.13.03 #Function : logRotate, Transfer the begining of a file to the rotationned version. #F01.14.01 #Function : logMe, Send the log to the log files #F01.15.01 #Function : logMeV, Send the log to the verbose log files #F01.16.03 #Function : isFunction, Verify that the function exists #F01.17.07 #Function : sprintf, return a formatted string #F01.18.02 #Function : ltrim, Remove all blank from begining #F01.19.02 #Function : rtrim, Remove all blank from end #F01.20.01 #Function : _str2lower, lower all characters #F01.21.01 #Function : _str2upper, upper all characters #F01.22.01 #Function : textFill, Create a text filled by the caracter #F01.23.03 #Function : textBox, Create a box around the text #F01.24.05 #Function : parseHeadersForHelp, Print headers of function for a given file #F01.99.02 #Function : F01Version, Return/Print version information #F01.23-1.02 #Function : _textBox4Bash, Create a box around the text
[1] Mes fonctions préférées sont sans aucun doute : sprintf et les *trim.
lundi 25 janvier 2010
Par Flyounet le lundi 25 janvier 2010, 22:39 - Outils & Développements
Après plusieurs mois à codouiller[1] des petits bouts de script Shell, j'ai décidé d'en faire librairie : F01common.lib.
J'ai tenté de la rendre la plus indépendante possible de sed et awk qui sont assez incontournable[2]. Elle fonctionne sous bash ou ksh.
Ci-dessous un aperçu des variables et fonctions :

En annexes sont fournis les fichiers indépendants, ainsi qu'une archive regroupant le tout.
Les fichiers sont :
common.lib.README : Une micro documentation,common.lib_v0.22 : La librairie Shell,common.lib_v0.22.mm : La liste de fonctions et variables sous forme de fichier Free(Mind|Plane),common.lib_v0.22.png : La liste de fonctions et variables sous forme de fichier image,common.lib_v0.22.tar.bz2 : L'archive qui contient tous les fichiers,test_common-lib.conf : Un fichier de configuration pour exécuter le script de test,test_common-lib.sh : Un script de test, qui exécute quasiment toutes les fonctions de la librairie.Les md5 des fichiers :
16fc140f5a69acdcbe5e1a21be185772 common.lib.README 3f5c5a78a3bc2da85e86395d65b88188 common.lib_v0.22 31bd6704a048d38ba1479ec42a0e97b2 common.lib_v0.22.mm d273f4afd7a95aa8aa899e53f5dca904 common.lib_v0.22.png 1d0c7dd2ce3d264a14bfd442dadf0d24 common.lib_v0.22.tar.bz2 4c550b4593b12cd849af697313139e33 test_common-lib.conf 5520dd6882f166f4688ffef981187b41 test_common-lib.sh
Les sha1 des fichiers :
076770bedcfef3cc2568b0d00185c47a5c84ab89 common.lib.README b9f251ee69112e2357f716fac604f3bb3d73b627 common.lib_v0.22 b7cf30403aec92271678e14f79af9a4fd1f82df8 common.lib_v0.22.mm 30790cd148091e996415a5f620e5128feb40d986 common.lib_v0.22.png 832f5c6938657396f1361f80ebcb327f31956bd1 common.lib_v0.22.tar.bz2 7113349a4f5d1ddd74e790f4c2fa782ace0af949 test_common-lib.conf 7be004717f6ca2f9281955888c011ac6209b03e7 test_common-lib.sh