We are using the Bourne-Again Shell. What does this error mean?: syntax error: unexpected end of file Answer The single quoted string starting with is missing the closing single quote. SO’s syntax highlighting shows it, too. Maybe you wanted to backslash the quote? or there are double quotes missing too…
How to make top run in background ? It needs to run and log the output. Not die or zombie up
I am trying to make a script to log the top output to a file in the background for my embedded system. But as soon as I put it in background, it either exits or zombies up. What is the systems problem with running things in background ? My script I am trying to execute it as and as How
how to add environment variable in linux for rails app?
i need to set an environment variable for the rails app to use the config settings for production is as shown below how can i set the environment variable using the linux command I tried to set the variable but looks like it needs to be for the right user. Sorry i am not an expert in linux. I appreciate
Bash: Parse CSV and edit cell values
I am new to bash scripting I have the following CSV Input Expected Output I need to check Location and Way and convert them to UpperCase – ABC, UP Day needs to be mon – Mon I need to do this for entire CSV. I need to correct the value and write all the fields on to CSV or edit
Working with multiple displays – will XOpenDisplay(NULL) sometimes fail to get current display of a window?
I have an *.SO library, which when called from an application, removes window decorations from the specified window. Here is my code: My question – with my current code set up – will it sometimes fail to remove window decorations depending on which display the window is currently displayed on? My …
Bash script: cd No such file or directory when file exists
My bash script is written to go to each subfolder in the current directory: When I run my bash script, I am getting a cd error for a directory that exists: Yet, in terminal command line I can do cd ‘Zelkova serrata’ within the same directory as the script and all is fine. Is it possible the bash s…
What’s the difference between XOpenDisplay(0) and XOpenDisplay(NULL)?
What’s the difference between Display XOpenDisplay(0) and XOpenDisplay(NULL)? In the above code I wrote an *.SO library for Linux that when called removes the window decorations of the specified window. In the line of that code which reads: I have tried replacing that with: And both usages seem to succe…
How to Mock Linux System Calls in C
When writing C modules that use linux system calls, what is the best practice to mock those calls in order to test the module? Are there maybe any libraries that offer mocks for linux system calls? “my-module.h” – The interface description “my-module.c” – The module to test…
Put quotes around string before first forward slash in line by line file read
I am writing a bash script that deletes all the files whose paths are given in delete.txt. delete.txt is thousands of lines long, each line has a path that is structured like this: Where there is a space in the name of the first directory. Currently, my bash script reads each line of delete.txt, saves it to$l…
Do linux read/write system calls use dynamic memory allocation?
I wonder if read and write system calls on linux (used with unix sockets) do dynamic memory allocation? The context are real time applications and deterministic behaviour. Answer No. If you look for syscalls in the Linux kernel source (I used grep -rn SYSCALL_DEFINE.*write to find read/write), you can see the…