I have been trying to investigate how to automate a script (shell or other) that periodically (once an hour for example) moves files with a constant naming convention to a folder (which is automatically created if not already there). The files are like this: Camera1_01_20171213221830928.jpg Camera1_01_2017121…
Tag: shell
Not able to change DOCTYPE line of a xml file in bash
I have a xml file with name alphabet.xml like below : – Now I want to replace <!DOCTYPE models SYSTEM “mp.dtd”> String of alphabet.xml with <!DOCTYPE models SYSTEM “/opt/nms_cif_mp/dat/mp.dtd”> code I am using is in below . But with this code replacement of the above …
parsing complex string using shell script
I’m trying the whole day to find a good way for parsing some strings with a shell script. the strings are used as calling parameter for some applications. they looks like: I’m only allowed to use shell-script. I tried to use some sed and cut commands but nothing works fine. My tries are like: that…
Bug while checking for symbols inside of a string?
I’m creating a small calculator script and I’ve got stumbled on a strange bug. Everything seems to work but not when I input anything starting with (. When I do that if gives false and the code inside of else executes. I’ve tried a lot of ways rewriting how should “$input” =~ [-,…
How to store command arguments which contain double quotes in an array?
I have a Bash script which generates, stores and modifies values in an array. These values are later used as arguments for a command. For a MCVE I thought of an arbitrary command bash -c ‘echo 0=”$0″ ; echo 1=”$1″‘ which explains my problem. I will call my command with two …
Recursively check the difference between files in shell
I am trying to recursively check the difference between files in 2 separate directories in shell. NOTE :- both directories are identical only the root name is different In the diagram shown above I want to “diff ROOT_A/A.md5 ROOT_B/A.md5” recursively in my script file for all files in the root dir…
delete all folders and files within a linux directory except one folder and all contents inside that folder
I have a directory structure as :- I want to keep the public folder and all its contents (further folders and files within it) but want to delete everything else under the directory /usr/testing/member/. But that also means member folder is not deleted. Is there any shell script or command that can be used to…
Creating files from a Python script within a shell script within a shell script
I’m trying to run a Python script from a shell script within a shell script, but I’m running into some problems. Imagine my root shell script looks like this: and my test2.sh: The python file is in the same directory as test2.sh but test2.sh’s working directory seems to be the root’s s…
How do you make a Concourse Linux Machine read executable files? (chmod style)
I am trying to get my Concourse CI Linux VM to run a shell script. But i keep getting the same error: I fixed this locally (non VM, on a Mac) with chmod +x path/filename.sh to make it executable and adding !#/bin/sh to the shell script. But i dont know how to get Concourse/VM to know that it’s an execut…
Compare A Variable Regularaly Using Linux Scripts and Cron
I’m trying to check if a number differs from what it was last time it was checked, in this case checking a number every minute, using Linux scripts and cron. eg: But the problem I am having is that the variables aren’t accessible between scripts and using source (eg. source script.sh) runs the scr…