Skip to content

Parsing a config file inside shell script

I am trying to parse an ini file inside a shell script. name.conf file: I could parse the values by the command I wanted to know if there was some way by which I could group the contents of my config and parse it name.conf file: I just need the values in a shell array say names and print them

If a File is Empty, Write Text to First Line

I need to check to see if two files are empty. If they are, then write “-999” to the file, else run an average on the numbers within the file. Here is the coding I’ve been trying to use: Code: Contents of file_all: Answer the appropriate way to check whether a file is empty is using -s not -…

Why can’t this user delete this file?

If I do: I see: If I sudo to root and then su to jenkins, I should be able to delete this, yes? Other relevant information about the directory and its parent: If I do: then I see than the user “jenkins” has been added to the “root” group: But if I: I get: Why is permission denied? Answ…

How to compute Cumulative values in Shell?

I would like to compute cumulative values from the below data file and writing them into columns after inserting a serial number. Where ifile.txt has 3 rows and 9 columns in this example. Desire output: Here first column is used for the serial number. So what I did is: I first converted into columns using The…

How OpenVZ boot OS?

I bought VPS on OpenVZ virtualization and enabled Debian guest OS. Guest /boot dir is empty. /etc/inittab is empty. How is the OS initialization process performed? What is the meaning of reboot for OpenVZ container? Answer After research I clone vzctl tool as main job about starting/stopping done here: vzctl …

Extract substring from string in linux

i need to extract oracle-xe-11.2.0-1.0.x86_64.rpm from oracle-xe-11.2.0-1.0.x86_64.rpm.zip and i have no clue how to start. The condition that must be met is only .zip needs to be removed. If there is no .zip then nothing should happen to the string . How to go with it ? Answer Use basename instead: Result: