Posts

Showing posts from February 4, 2019

using awk with if and z option

Image
0 when I want to check if a returned value is integer or not I use this in bash script: if [ -z "$value" ] then echo 0 else echo $value fi I was trying to use z option in awk with if. for example i have this line: PRIMARY SECONDARY CONNECTED 350 800 I tried using this: /bin/awk '{if( -z $1){print "0"}else{print $1}}' script no matter i replace $1 with $2 or $3 or $4 or $5 it always return 0 . am I using awk in a wrong way? bash shell-script awk share asked 1 min ago BlackCrystal BlackCrystal 323 11 ...

Sublime (groupe)

Image
Pour les articles homonymes, voir Sublime (homonymie). .mw-parser-output .entete.musique{background-image:url("//upload.wikimedia.org/wikipedia/commons/6/60/Picto_infobox_music.png")} Sublime Données clés Pays d'origine Long Beach, Californie, États-Unis Genre musical reggae, ska, hip-hop, dub, punk rock Années actives 1988–1996 Labels MCA, Skunk Records  (en) Composition du groupe Membres Bradley Nowell (†) Eric Wilson  (en) Bud Gaugh  (en) Lou Dog  (en) (†) modifier Sublime était un groupe américain de Long Beach, en Californie. Il fut actif de 1988 à 1996. Le mélange subtil des genres (tels que le reggae, ska, hip-hop, dub, et punk rock), l'humour et le décalage des textes mais aussi la fantaisie des reprises en font l'un des groupes les plus influents de la scène californienne des années 1990. Sommaire 1 Membres 2 Historique 3 Après Sublime 4 Sublime with Rome 5 Dis...

Eval and exec with variable substitution

Image
0 I'd like to execute a statement to start a server. For that I have an environment variable to determine which server is to be started. I was given this command as a starting point: eval "exec gunicorn --chdir /this/dir package.sub:call_main() -b 0.0.0.0:80" As I have a few kinds of servers to start up, I would like to parameterise the script. And after searching around, I found out the quotations are redundant. So what I have now is: APP=main eval exec gunicorn --chdir /this/dir package.sub:call_${APP}() -b 0.0.0.0:80 This, however produces a syntax error near unexpected token '(' . Ideally I would even like to have a default argument like ${APP:-main} , but I guess that is possible once the syntax error issue is resolved. What is wrong with the statement above? Additionally, is...