Background — my linux host became unresponsive.
discover cpu count ] my machine #lscpu is how I found out cpu count.
top -n 1
Load average was 45, on sixteen CPU’s. It works out to be almost 300% loaded. After I killed top 5 processes, load average dropped to 13 and system became much faster:) …. one of my most successful performance fix stories.
perl -l0pe # el and zero, to “collapse” all input lines
I faced the same problem as described in https://stackoverflow.com/questions/1221833/pipe-output-and-capture-exit-status-in-bash.
set -o pipefail # The exit status of a pipeline is the exit status of the last command in the pipeline, unless the
pipefail option is enabled.
This works with set -e.
export LS_COLORS=’di=0;4:fi=0:ln=31:pi=33:so=33:bd=33:cd=33:or=0:mi=0:ex=0′ # affect ls only. Seems to disable all colors 🙂 Most colors are bad on black background.
- In perl, all the modules I have seen require a date in the string 😦
- I did a smaller search in python.. same result.
I would guess that we must get today’s year/month/date first. Modify the string and it should be easily parsable.
In shell scripting, I have learnt to favor printf over echo
- printf gives us precise control
- q[echo] is built-in and also a command … confusing!
I managed to split a huge g++ command line to about 300 lines… much more readable.
- terminate each line with a space, a backslash and … NO trailing space
- my perl one-liner must user four backslashes to insert that single backslash, then another \n
- total there are 5 backslashes in a row.
Here’s the command
perl -pe "s/ -/ \\\\\n-/g" build1file.sh
Still no definitive answers…
In one machine, q(ulimit -c) returns 0 meaning suppressing core files. I had to run q(ulimit -c unlimited) to get my core files generated.