I have created a console application which have a menu that allow me to navigate between the menu items. I handle the navigation logic in this method: here the full class. Now on windows all works well, but when I run this application on my linux with systemd I get: Unhandled Exception: System.InvalidOperatio…
Preventing expansion/evaluation of parameter in ssh command
I have a shell script that runs a docker container on a remote server. I’m trying to send the hostname of the remote server into the container but i just get the hostname of my local computer where i run the script. The command looks like this in the script: Both hostname and the environment variable ho…
Linux rename with a variable character?
I have a list of files eg. How do I use rename to be like this: I am new to this and having trouble understanding the examples online. I want to do something like the following where the ? is a variable character: Answer ? mean “any character”. So, your page-1.htm will be rename because it’s…
Storing and accessing an array of struct from shared memory
I am writing a program on a hotel reservation system and have declared a struct Room as follows: I use a variable read from an input file to create an array of n structs which is all the rooms in the hotel. I then create the shared memory space and attach it, but when I try to access it after,
How to reproduce the accept error in Linux
I’m learning Unix Network Programming Volume 1, I want to reproduce the accept error for RST in Linux. server: call socket(), bind(), listen(), and sleep(10) client: call socket(), connect(), setsockopt() of LINGER, close() and return server: call accept() I think that the 3rd steps will get an error li…
Linux SHELL script, read each row for different number of columns
I have file and for example values in it: I need to read values using the shell script from it but number of columns in each row is different!!! I know that if for example I want to read second column I will do it like this (for row number as input parameter) But as I mentioned number of columns
What kind of owner and group for these below list of files?
what is the owner and group of this below file? It has 0 and 0 for owner and group. I found those permissions after connecting to a remote server for which we does not have write permissions. How to replicate the same permisions in my development machine? Answer 0:0 is almost always root:root owner and group.…
How to pass “-L” to an awk script?
I am trying to write an awk script that accepts -L as an argument. As an example to show you what I want, here is a simple awk script called awktest: If I run this from shell: I get as output: Which is what I expect. It seems to work for anything I put in except -L. If I run:
Segmentation fault when maping /dev/mem
I’m trying to mmap a memory from my FPGA on a linux running on my Zedboard SoC. I can read the contents correctly using devmem on the command line, but when trying to read it through C I get a segmentation fault. The barebones code shown below throws the segmentation fault when trying to print the conte…
Return custom process command in Ubuntu
I want to launch the following script in bash and the “ps -A | grep php” command returns something if the script is running. Is there any way to customize this “php” command with another name? I want to write and “ps -A | grep php” should return nothing, but “ps -A | …