I'm in my first semester of BASH Scripting and I am having some difficulty. I've taken other programming courses like C++ or Java but the syntax of Bash is killing me. I'd love some advice on this problem. I need to do the following:
- Extract Today's data from /var/log/secure file
- Check to see if I have a directory called 'mylogs'
- If I don't - then create one
- Check to see if you already have a file matching the current day, month and hour in the ‘mylogs’ directory.
- If you do, echo to the screen “File exists, nothing written to my log”, and exit. If it doesn’t exist then write today’s data from /var/log/secure to your ‘mylog-month-day-hour’ file. Example (February, 4th at 2pm) output: mylog-02-04-14
I just need help with the syntax portion of the script.
Thanks - I'd love any websites helping out in BASH as well.