I’m working on an optimization and for that I need to link a matlab code into a linux program and keep monitoring the outputs. I’d done this link using this sh below, however it wasn’t working well, since I couldn’t keep track of more than one ‘expression’. I’ve asked for help here, and I got a good solution. The solution
Tag: shell
bash scripting, handling spaces in filesnames in a for loop strange behaviour
help. everything i’ve tried has failed. I’m trying to fix up my video collection and lots of them have spaces in the names/etc I want to transcode them and I’ve written the script below, but its failing. 2 of the filenames I’m using for testing are “13 Eerie (2013).avi” and “Ace.Ventura.When.Nature.Calls.1995.720p.WEB-DL.x264-mSD.mkv” i have tried several things from using print0 on
Time multiple commands running in parallel in shell and save it in file
I have a bash script for which i want to know the time it took to run for individual commands and save them in a log file. Also I need some of these commands to run as a different process. The problem I am facing is I am not able to tell which output belongs to which command for example
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 automatically, so I
zsh option to generate the recomended options
There is a nice option when setting up zsh on Ubuntu However, on a fresh Arch Linux install the option is missing. Is there a way to have it (or maybe, I am being picky here) ? Answer This happens when you haven’t got a .zshrc and there’s a /etc/zsh/recommended.zshrc. If you say yes, it’ll just copy that one to
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 check work for me if connection is refused. However,
using watch , tail and ccze together
I have used watch and tail together like this: Also I have used tail and ccze for colorizing log file as below: But I dont know how should I use all of these three together in a single command. Does any one have any idea? Answer Recent versions of watch has -c | –color option, so perhaps this will work
Delete a single line from a file with a unix shell script
I’m working with a simple shell script that needs to delete a single line from a file if a string entered at command line is found. Instead it deletes the entire contents of the file. the data file is like this(each entry is on a new line): my code: Answer N means the line number , begin from 1
How to write a bash script which automate entering “docker container” and doing other things?
I want to implement an automatic bash script which enters a running docker container, and do some stuffs: Executing the script on terminal: The output shows only login the docker container, but won’t do other operations. Is there any method to automate entering docker container and doing other things? Answer You can use bash -c: For running a series of
Unexpected EOF while looking for matching `”‘ shell script
I get when I try to run a shell script that I made, but I don’t see any misquotes on lines 36-38 SCRIPT: Answer Fix escaping of ‘: replace all ‘ by ”’.