I am trying to set the variable $file as “Unavailable Voucher’s Report_Apr-2017.txt”. It is getting set to the variable successfully. But I am getting an error when I use this variable in a SCP command inside my script. I have tried to replace the ‘ ‘(space) with ‘ ‘(…
Tag: linux
Is there any faster way to grep the pattern or to increase the speed of while loop?
this loop is taking time because lacks of entry in main_file. Answer Your current approach is very inefficient – the whole loop could be done in a single grep, with the -f option. -F treats lines in file as strings, not patterns -x looks for exact matching line (if that is what you want) -f file reads t…
linux c: what’s the common use case of “sched_setaffinity” function? I don’t find it useful
The operating system is able to determine how to arrange difference processes/threads onto different cpu cores, the os scheduler does the work well. So when do we really need to call functions like sched_setafficity() for a process, or pthread_setaffinity_np() for a pthread? It doesn’t seem to be able t…
embedded linux/QNX – how to completely zero out flash
I have a bug related to persistent files. To determine the exact sequence of steps to reproduce the bug, I need to start out the flash disk at a known state. QUESTION Using linux/QNX commands, how do I completely zero out the entire flash disk while being Telnet’d into the system? Answer On QNX, you can…
Scanf a char pointer in Assembly
So I have a task to do, which requires from me to scanf a char* in assembly. I tried this code: It writes down first printf correctly, then it waits for input (so scanf works), but then when I enter anything -> Segmentation fault. I know, that the char* should be somehow initialized, but how can I do it fr…
pip install pickle not working – no such file or directory
Ubuntu 16.04 LTS, trying to install cpickle with pip. I’ve searched a bit, haven’t found anything useful yet. PYTHONPATH isn’t set. Error message troubleshooting steps Answer Checking on the interweb, I found this A common pattern in Python 2.x is to have one version of a module implemented …
Example device-tree-aware i2c gpio driver for Linux?
Is there a good example device-tree-aware i2c gpio driver for Linux? I’ve been looking at gpio-pcf857x but it has a header file containing struct pcf857x_platform_data which is used in board files. I am looking for a similar example, but where the i2c id is defined-in/retrieved-from the device tree. Ans…
Detailed documentation for systemd’s sd-bus
I have some project which uses libdbus for IPC. The goal is to use systemd’s sd-bus instead of libdbus. There is documentation for sd-bus (here, here and etc), but that documentation doesn’t cover all aspects of D-Bus specification implementation. I spent a lot looking for at least any detailed ex…
Redirect the standard output [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations. Closed 5 years ago. Improve this ques…
Linux userspace header failing to compile with g++
I have a cpp source file in which I have included the following Linux uapi header: #include <linux/netfilter_ipv4/ip_tables.h> I’m using RH6, but the header seems to be identical to the one found in the Linux kernel mainline: http://lxr.free-electrons.com/source/include/uapi/linux/netfilter_ipv4/i…