News for hackers. Stuff that matters.
Re:GNU make insanity: finding the value of the -j parameter by anon4 on Saturday March 28, 2015 @05:41PM (#9282854)
Note: you can forego the ps and simply read /proc/$PID/cmdline, which is a \0-delimited list of strings. So,

    grep -oP '\-j\x00\d+' /proc/$PID/cmdline
Edit: and no need for sed when a simple cut -b4- does the same job.
Re:GNU make insanity: finding the value of the -j parameter by Someone on Saturday March 28, 2015 @07:40PM (#9283228)
If you are willing to use /proc, you basically have Linux, and can assume just as well that your shell is bash.

If so, $$ is the easiest way to get the PID of the current shell. That works in several other shells, too, but I am not sure sh is guaranteed to have it (FreeBSD's sh has it. See http://www.freebsd.org/cgi/man.cgi?query=sh)

Re:GNU make insanity: finding the value of the -j parameter by protomyth on Saturday March 28, 2015 @06:26PM (#9282979)
Does that work on anything other than Linux?
Re:GNU make insanity: finding the value of the -j parameter by myhf on Saturday March 28, 2015 @07:04PM (#9283126)
Not in exactly the same way, but every unixy system has some way of finding the parent pid and looking up its command line.
Re:GNU make insanity: finding the value of the -j parameter by protomyth on Sunday March 29, 2015 @01:37PM (#9285684)
Is Quanticles's code portable to the other unix systems?
Re:GNU make insanity: finding the value of the -j parameter by myhf on Sunday March 29, 2015 @09:19PM (#9287204)
It should work on most systems that have a /proc filesystem: http://en.wikipedia.org/wiki/Procfs

If you don't have /proc but do have ps (1), you could get the parent pid like this:

    PID := $(ps -p $$$$ -o ppid=)