I want to decrypt and mount the default eCryptfs private directory by executing the “ecryptfs-mount-private” terminal command in C++ and providing the passphrase/password from the same C++ script. I have tried forking then exec the shell (/bin/sh) and opening pipes for I/O with sh but when I try t…
Tag: linux
Trying to use Boost 1.69.0 from CLION while Visual Studio works, but giving weird MINGW errors
Visual Studio is aweomse. It works, but I like using CLION and has no debug feature, so I try to use MINGW, but I get this weird undefined reference errors. My CMakeLists.txt: So now from this part it builds and works with Visual Studio, but given I try to debug with CLION, I try to use with MingW (besides I
Can I omit the full path of a “shebang” on the first line of shell script?
I often see #!/usr/bin/env bash at the first line of shell scripts. It seems to work fine to omit /usr/bin/ part on macos: Can I do that on all other Unix-like platforms? Answer Using interpreter without full path is not supported everywhere. In many cases, kernel does the shebang handling and kernel normally…
Run a bash script to shutdown tomcat from another directory
I have two scripts, one to run the application shutdown for Tomcat server, and another that calls it when deploying. So basically after Jenkins builds my application, and moves the deploy-able artifact to the server (linux). Once that completes Jenkins kicks off a script to do the deployment of the applicatio…
gdb can’t cross-compile for arm-linux
The Linux already having both gcc & arm-gcc in the environment path: So I configure the gdb 6.6: compiled without error, but looks like gdb used the wrong compiler. So How to indicate the correct CC for gdb? I tried make CC=arm-none-linux-gnueabi-gcc, but will get the error: Answer Don’t use –…
Linux how to remove files in one folder where prefixes don’t match another folder?
I want to remove extra files in one folder where the prefix file names don’t match those in the other. A simple example will show: From folderA I want to remove frame0002.jpg and frame0006.jpg because those frameXXXX prefixes don’t exist in folderB. How can I do this automatically in 1 command lin…
need help on shell script for expected output
I have an input file called input.txt like this: I extract the text up to just before the fist capital letter in the first field and store those snippets in output.txt: I used the sed command to separate out the values and it’s working fine. From the output file (output.txt), I need to grep from the fir…
Multiple CLOSE_WAIT when using google cloud speech api with tornado server. Too many open files error
I am getting multiple threads of the same process in CLOSE_WAIT because of which i am getting ‘too many files open’ error. This is happening when multiple calls to google cloud speech api is made. Have gone through various answers on stackoverflow, but i am unable to figure out the solution. The c…
Code works logically on macOS but not on Ubuntu 16.04.5
I have a task to write the function: int read_palindrome(); // input comes from stdin which will read one line from standard input and returns 1 if the line is a palindrome and 0 otherwise. A line is terminated by the newline character (’n’) and the does not include the newline. There are requirements to be m…
Bash inline version of piping file to bluetoothctl
bt.sh If I pipe the above file to bluetoothctl, it works as expected. But how can I do that as an inline script, I have tried the following but it does not work and bluetoothctl does not appear to register the commands: Answer Use a command list: