Skip to content
Advertisement

Tag: shell

‘Housekeeping’ script to create folder and move files

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_20171213223142881.mp4 Basically it will be doing ‘housekeeping’. I’m new to shell scripts, and I just

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 specific string is not happening . NOTE : The above code logic works if I

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 return the correct value of

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” =~ [-,+,*,/,(,)] look like but nothing worked. Do you

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 arguments -option1=withoutspace and -option2=”with space”. So it would look

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 directory. However, This doesn’t work. can someone help me out

Advertisement