I have to come up with a solution to delete all files but the newest 2 in a directory stucture of our owncloud. The be exact – its the file versioning folder. There are files in one folder with the following structure: Filename.Ext.v[random_Number] The hard part is that there are different files in one …
Tag: bash
mkdir makes wrong directory names when used with cut on *.tex files
When make directories for each file with certain extension: …everything works just fine. However if I do it for .tex files I get following results: I just wanted to clean my latex directory and I get weird directory names. Why is that and how to make it work? Answer It is error prone to use output from …
Executable Unix script cannot be found by which command
I have a Unix bash script written by a former teammate that must be in my PATH, though I can’t find it by manual inspection (see below). I can however execute it anywhere by just typing I would like to view and edit this script. However, when I try to find it via the which command, I get a blank
AWK script automatically removing leading 0s from String
I have a file BLACK.FUL.eg2: I’ve written this AWK script: which gives me an output of: with one problem: the leading 0s of strings in field1, are automatically getting removed due to a numeric operation on them. So my actual expected output is: For that I’m trying the below updated AWK script: Bu…
How can I control the number of running processes?
I’m doing a shell script and the unknown situation occurred. I must execute a certain number of processes, lets suppose 12. But I want to limit the executions by ‘t’ each time. So if ‘t’ is 3 I would have to execute 3 processes then 3, 3 and finally 3. But I would like to do it a…
How to open new bash terminal using Python
I am trying to open a new terminal window in Tkinter application. I’ve used os.system(“/bin/bash”) but it works in current bash only. Which stops runnning code and causes application freeze. I want to open new Terminal. How to do that? gedit like programs work fine without disturbing current…
Why is execvp() executing twice using fork()?
I am implementing a shell. When attempting a command other than changing directories, execvp() runs, the child terminates and a new child is created. When I change directories, the child does not terminate and a new child is created. Here is a sample of my code: cd ../; ls; runs correctly, except I have to Ct…
How to find if remote host is reachable over SSH without actually doing ssh
I have multiple remote hosts connected to my local host (server-A). TO ensure/filter the list of hosts which are genuinely reachable to localhost , I do ping test. However ping test could not provide me any check to ensure that filtered remotehost-IPs are reachable over SSH connection /port 22. Query: Above c…
hard-coded bin path and NixOS
When I try to do a manual source install of some software on NixOS 15.09, I get (sh -x is to get an exec log): And indeed there is no bash program in /bin/ However when I inspect the script I dont see any mention of it so it must be some subprogram looking for it. As an aside, I
(Scp – Permission Denied (Public Key) [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack …