how to make several comparisons in the bash by placing the condition and comparison points next to instead of the long queue ? that something like this before : after (what I want): Answer Try this using bash regex with the keywork =~: Edit : As seen in comments, for real you need to compare int, not strings,…
Dynamically loading shared objects with/without version numbers
In a Linux program, I need to load a shared object called libfoobar. On my system, there’s libfoobar.so, libfoobar.so.0 and libfoobar.so.0.0.0. On another system with a different distribution installed, libfoobar.so does not exist, only the other two variants are available. What is the correct filename …
Why does my shellcode segfault when executed from C, but not as a stand-alone executable?
I’m trying to execute a shell with shellcode. I’ve made this code in a 64-bits machine: After using nasm and linking with ld if i execute the file this works fine. The problem is if i get the shellcode from this and tried to execute it with this program: It gives me a segmentation fault error. I c…
How to use environment variables in a .service script
I have an elixir project on a linux server. I have created a .service script which will start and stop the application with the following commands The .service file looks something like this… It works as expected, the one exception being that it will not read the environment variables. I can give the ap…
Grep Regex: How to find multiple area codes in phone number?
I have a file: each line consist of a name, room number, house address, phone number. I want to search for the lines that have the area codes of either 404 or 202. I did “(404)|(202)” but it also gives me lines that had the numbers in the phone number in general instead of from area code, example:…
GCC Bug, “linux” string in path replaced with “1” when using “” angle brackets to include a header through a macro
I may have found a bug in gcc. I couldn’t find anything related to this online so I want to know if anyone seen this before. I am using “Ubuntu 16.04.0 LTS” with: gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.6), but this problem can be reproduced on later gcc versions as well, gcc…
Convert column to matrix format using awk
I have a gridded data file in column format as: I would like to convert it to matrix format as: Where top 20.5 21.5 22.5 indicate y and side values indicate x and the inside values indicate the corresponding grid values. I found a similar question here Convert a 3 column file to matrix format but the script i…
Using wget to download images and saving with specified filename
I’m using wget mac terminal to download images from a file where each image url is it’s own line, and that works perfectly with this command: However I want to specify the output filename it’s saved as instead of using the basename. The file name is specified in the next column, separated by…
Send email with html body and some attachment with sendmail
Follwing this https://stackoverflow.com/a/11725308/1507546, I could send an email with one attachment. However the body is always empty. Why is my function sending emails with empty body and how to fix it? Answer I figured it out after playing with the headers, this worked for me.
Kate Editor Reset Settings
How can I reset the changings, i have done in Kate on a non KDE desktop? In Settings under Configure Kate in Fonts & Colors i mistakenly changed Vim(dark) to “Use KDE Colour Scheme” The Problem is, that it overwrote Vim. Answer A Kate developer here: There is no option for that in the user int…