Skip to content

Tag: linux

Why does (ps -f) create no subshell but a separate process?

I need some help because I don’t get something. From what I read from Internet, a subshell is created when we execute a shell script or if we run command in brackets: ( ) I tried to test this with a script which contains only the following command: When I run it I see the following result: Which is good…

awk sum every 4th number – field

So my input file is: I want to sum the numbers then write it to a file (so i need every 4th field). I tried many sum examples on the net but i didnt found answer for my problem. My ouput file should looks: Thanks! Update: The problem is the same. I want to sum the 3th numbers (But in

trouble with opening file for read with fopen

I am new to writing c under linux so this will be maybe silly question, but I have problem using fopen. When I encountered the problem I just tried it with this really simple code: test.txt is in same folder as this code and a.out. When I debug a.out I get: I tried changing the path: if( fopen(“/home/h1…

How to read a file line by line

I try to read a file line by line. File to read: Script: When I execute the script, this window will be opened: (Notice how some values are repeated, and the contents don’t correctly alternate between names and versions): I’d like to create an array with all package names and versions. Answer You …