bash script help needed
Hi everyone, This is the first time I posting question here. Please be nice to me. I'm not a very experience Linux user so I really need some help here because of my limited knowledge to Linux.
I want to write a script to change few setting in few configuration files in RHEL 6 and 7. Below are some of the thing i want to archive: 1. Make a copy for all the files that will be modify by the script with format file.DDMMYYYY. If found a backup exist then ignore. Cause I done some testing and found out that if the scripts executed more than once in the same date, then the backup file will be the one that have made changes of. 2. The script will find certain parameter in a file and change the value if found. If not found then add the parameter in. 3. If the file is not found, then create the file and put the parameters in the file. Set permission for it as well. Below is the noob script I have done, I know there are a lot of improvement with the script. The script is just an example of what needed to archive. Hope there will be nice guys willing to share their knowledge with me. :) Code:
#!/bin/bash |
Quote:
Also, if you use code tags, it is lot easier to read... |
Quote:
|
Quote:
Code:
#!/bin/bash Quote:
|
You need a leading '.' when using globs with sed.
Consider this example. Code:
$ foo='Setting_C=foo' |
your two timing cat fix.
Code:
#!/bin/bash |
You can drop the back slashes after '&&' or '||'. :)
|
All times are GMT -5. The time now is 09:55 PM. |