I have a requirement to change the contents of config.tsx file that contains values like: I want to change this content using a shell script and save the file. Changed content can look like: How can I do this? Answer This should work: The -i option will edit the file in place. If you first want to try the com…
C sockets
The following C program calls select() to get a list of client sockets that have data in the socket buffer (using UNIX domain datagram sockets). It takes four parameters on call from a NASM program. The parameter fds_array[] is a 3-element integer array created in NASM and passed into the program. The data ar…
How logical operators works
I tried below but it doesn’t work. Throwing some errors. Exp1 or expr2 should evaluate first & at result should be evaluated with expr3 ( &&) i tried as per suggestion, it throws error as Fyi- that date is val1 value. Answer You might see different results based on the shell or version, eg: …
How does the ELF64 loader know to update the initial addresses in .got.plt?
Consider the following program hello.c: The file is compiled with gcc -o hello -Og -g hello.c and then loaded with gdb hello. Inspecting the GOT for the call to printf with p ‘printf@got.plt’ gives which is the offset of the second instruction in the corresponding PLT entry relative to the start o…
BUG: unable to handle kernel paging request when accessing a custom struct in syscall
Using linux with kernel 4.4.21, I was required to implement a system call which has a custom struct’s pointer among its parameters. These are the files to to edit: I put sys_procmem.c (implementation) in linux-4.4.21/kernel/sys_procmem.c (sys_procmem.o added in that dir’s Makefile): Test: Both wer…
iraf, make: *** No rule to make target ‘sptable’. Stop
I am working with Iraf and I need to install the external package “sptable”. The only way I found in order to install Iraf nowadays is described in this site: https://glauffer.github.io/2018-08-03-the-easy-way-to-install-iraf/ In order to install sptable I found two site which describe the same pr…
can you guys help me to debug a simple c program with gcc and make it work? (student problems..) [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question Hello guys so my question is can you help me to debug a simple c program with gcc and make i…
change default environment from (base) to (env) in conda/anaconda in Ubuntu
My question is not about changing the .bashrc file to append source activate env because it does the same same task. I have no problem writing an extra line of code everytime I use the environment but the problem is that when I deactivate, it switches it to (base) back again. How can I stop switching to make …
C++ | How to get input from the arrow keys with Linux
I’m super new to C++ and was wanting to add arrow key functionality to my snake game. I’ve been scouring the Internet trying to find a way to do this without “conio.h” as I am using Linux. How would I go about doing this and can I get some example code? Thank you! Answer You’d be…
how do i access files in directory from another directory (linux)
im trying to change permissions on a txt file founded in directory X While im in the directory Y Answer You should use absolute or relative file path. For example you have file1.txt in directory /directory1/ – absolute file path is /directory1/file1.txt. If your current path is /directory2/, you can run…