Skip to content

Tag: redirect

Is pipe in linux asynchronous or not?

I thought that when i running below commands Linux process will be when sleep 10 is end -> sleep 2 (when sleep 2 is end)-> sleep 5 that’s i thought But in Linux bash sleep 10, sleep 2, sleep 5 are in ps same time Standard output of sleep 10 process will be redirected to sleep 5’s process But…

Does an argument after a redirection do anything?

Is any argument after a redirection ignored, or does it have any unintended consequences? I was surprised to find that a typo I made in my bash script made absolutely no difference because it was specified after a redirect. E.g. I expected it to complain about something like this But it doesn’t throw an…

Redirecting output of a program to a rotating file

I am trying to redirect the output of a continuously running program to a file say error_log. The command I am using looks like this, where myprogram.sh runs continuously generating data and writing to /var/log/httpd/error_log myprogram.sh >> /var/log/httpd/error_log Now I am using logrotate to rotate t…

How to force HTTP to HTTPS with an exception?

So I had to force all connections via HTTP to go to HTTPS on a specific folder (e.g. “public_html/folder1”). I found a tutorial somewhere and used the following in an .htaccess file: Problem is, I have a folder inside that folder1 which should be allowed to be accessed via HTTP and not just HTTPS,…

system call open() creating executable

So my code creates and writes to the out_file properly. However, the file is an executable for some reason. I think the fault is in my open() call but I can’t seem to find why. Answer man 2 open explains why: So if you want a file that’s not executable, you can use: 0666 will suggest read/write fo…

sed – Piping a string before the last line in a file

I have a command that prints a single line. I want to add/pipe this line to a file, just above its last line. I just find an empty line in the correct place, above the last line. I notice that when I add any string as ‘$i foo’, the “foo” gets printed in the correct place, but I want th…