Je me mets ça de côté pour gagner du temps la prochaine fois
logfile=/tmp/logfile.log
errorfile=/tmp/error.log
function log() {
echo -e "\e[34m\e[1m[$(date +%Y-%m-%d) $(date +%H:%M:%S)] $1\e[0m" | tee -a /tmp/logfile.log
}
function logerror() {
echo -e "\e[91m\e[1m[$(date +%Y-%m-%d) $(date +%H:%M:%S)] $1\e[0m" | tee -a /tmp/logfile.log
}
log "prout"
logerror "pwet"
function sayhello() {
echo hello
}
OR
sayhello() {
echo hello
}
Et en one-line :
sayhello() { echo hello; }
Je prefere la deuxieme solution :
function myfunc()
{
local myresult='some value'
echo "$myresult"
}
result=$(myfunc) # or result=myfunc
echo $result