I have a cron job that calls a script that checks for updates once every hour. If there are updates, it will call update.sh, which in turn calls commands.sh. I would like each “new” commands.sh to be run exactly once. I was thinking of writing to a file each time I run commands.sh with some unique ID of that file.
Tag: shell
Merging two files in bash with a twist in shell linux
The following question is somehow tricky but seemingly simple , i need to use bash let us suppose i have 2 text files, the first on is FirstFile.txt SecondFile.txt I want to be able to create a new Thirdfile.txt that contains that values that are not in file A , meaning if there is a common variable with file A
Unix shell script to search for error codes in thousand files then print the count in text file
I need to find both 150+ eventType and errorCodes in 1700 files each day. That means i have to loop over 1700 files to find the occurrence count of 150+ eventType/errorCode and put those counts in a text file as a daily report. I have placed those eventType/errorCode values in a text file separated by commas: My initial code: The
Extract text with any command in linux shell
How do I extract the text from the following text and store it to the variables: Here, I want to store 05 in one variable, 21 in another, 09 in another and so on. All the value must me stored in array or in separate varibles. I have tried: I need a more clear solution or short solution. Answer Your
ignoring variable containing and multiple spaces usnig sed command
I have two variables, i want to replace ESX_10.2.3.4@10.52.33.21 with new pool ser/@10.25.89.322 and also want to remove space before new word. i have tried like, and I don’t want to delete space ,just want to replace as it is(except space before “new”). Answer Give a try to this: It is removing the space in the first occurrence of new
command not found in zsh when it is there
I just installed the android SDK and was trying to run the emulator when this happened: emulator seems to be in one of the $PATH directories, but zsh still says that it wasn’t found. What could be the cause? Answer Solved it. The problem was that emulator was a 32-bit ELF binary, and I didn’t have the 32-bit runtime libraries
How to write shell script,to automate file conversion?
I have 30 files(ascii),which I want convert to binary.Linux command line(FORTRAN 77 CODE) that has been compiled Relevant part of the code Then code asks for input and output file names How to automate this?I have tried like this Or But I do not have a clue for next step.Text files are Output files Answer Try this: The variable op_file
Shell complains about file permissions when creating a config file
I’m not completely sure if I should ask here, over at the Unix forums or somewhere completely different but, here we go. I’m using Packer to create a set of images (running Debian 8) for AWS and GCE, and during this process I want to install HAProxy and set up a config file for it. The image building and package
how to delete all files in directory except one folder and one file?
I have application which has one folder called vendor and one file called .env. When ever i automatically publish my source code files to folder, all old files should get deleted except these two. How can i do this in linux by using shell? PS : I am trying to implement rollback mechanism in Jenkins. I will copy artifacts from
install mysql 5.7 purely from bash script on Ubuntu
I want a bash script that installs a MySQL 5.7 instance without needing any manual input. I was following the tutorial on Digital Ocean and it says for 5.7 you have to run the following commands and then put commands into a prompt (screenshot below). How can I automate the installation if it requires me to use a prompt? Should