Created
September 12, 2019 13:36
-
-
Save rogersguedes/6221f08825470e39f7a2882500cad28e to your computer and use it in GitHub Desktop.
this scripts copies the first file modified in current folder. It was used to backup a config file generated by SW4STM32 during the OpenOCD firmware upload invocation.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# this scripts copies the first file modified in current folder. It was used to backup a config file generated by | |
# SW4STM32 during the OpenOCD firmware upload invocation. | |
# 'inotifywait' binary is part of 'inotify-tools' package on Ubuntu 18.04.1 LTS | |
EVT_OUTPUT=`inotifywait -e modify,create,delete -r .` | |
FILE_NAME=`echo ${EVT_OUTPUT} | sed "s/[^ ]\+\s\+[^ ]\+\s\+\([^ ]\+\)/\1/g"` | |
cp ${FILE_NAME} ${FILE_NAME}.bak |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment