Last active
June 11, 2021 04:24
-
-
Save tensorturtle/43dffce0736ea63f4a016319e276246a to your computer and use it in GitHub Desktop.
Compile .cpp on write
This file contains hidden or 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 | |
| # start this script in one window, passing in .cpp file as argument | |
| # open text editor in another window | |
| # when you make edits and save file in the text editor, this script will run to compile and run the C++ code | |
| inotifywait -e close_write,moved_to -m . | | |
| while read -r directory events filename; do | |
| if [ "$filename" = "$1" ]; then | |
| g++ "$1" | |
| ./a.out | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment