Skip to content

Bash escape character

I have this very reduced example of a bash command, where I want the $ sign escaped. So the command : should print out: a simple $test does not work unfortunately. I tried lots of other stuff but still couldn’t find a solution. Any suggestions ? Answer Put it in single quotes rather than double quotes. …

Measuring Elapsed Time Using clock_gettime(CLOCK_MONOTONIC)

I have to elapse the measuring time during multiple threads. I must get an output like this: Firstly, I used gettimeofday but I saw that there are some negative numbers then I made little research and learn that gettimeofday is not reliable to measure elapsed time. Then I decide to use clock_gettime(CLOCK_MON…

My file doesn’t return the magic file message

I have to create a magic file that can detect a result of 42 on the 42nd byte. I’ve created the following line to then compile but when I run file -m <file_name> with this content I get the message Answer Your magic should be like this: Here’s my test: