I need as script (awk/sed?) to add noatime option to fstab.
It should append ,noatime to whatever is in column 4 if noatime isn't already there, leaving comments alone.
input:
Last edited by Franklin52; 01-26-2012 at 03:40 AM..
Reason: Please use code tags for code and data samples, thank you
I really don't think it'd make sense to add it to 'swap' partitions. In fact, I think you should be very careful what partitions you do add it to. meanwhile, now that you're forewarned, here's what you wanted (except without swap):
You'd want to use it like
And of course, test this thoroughly before letting it replace real data. Messing up your fstab's would really stink.
This really good. 3 questions:
1) why does this seems to mess up white space? I think my original fstab is tab delimted, hte result is space delimited
2) what does the 1 do at the end of the awk command?
3) What issues would there be with putting noatime on swap (or any other fs type?)
This really good. 3 questions:
1) why does this seems to mess up white space? I think my original fstab is tab delimted, hte result is space delimited
Because I didn't change awk's output separator, and I had no indication you wanted tabs. It shouldn't matter to mount in any case.
Quote:
2) what does the 1 do at the end of the awk command?
Prints every line. It could be an expression, too, so /slartibartfast/ instead of 1 would only print lines containing slartibartfast. Or X==1 to only do so when the variable X is set to 1. And so forth. You can leave it off completely, which would cause it to default to false.
Quote:
3) What issues would there be with putting noatime on swap (or any other fs type?)
Options are filesystem-specific, and if the filesystem doesn't understand them they may fail to mount. 'noatime' in particular makes no sense at all for swap since it doesn't even contain any files at all, so if it'd mess up anywhere, it'd mess up there.
I want to be able to add to any script that gives the option to continue or not, after the the first loop thru and to keep giving you the option after the user answers "Y" then does their thing then gives that option again once done. I've been seeing examples online on how to do it, but not for it... (2 Replies)
hey all,
I already installed nautilus-actions
now , I want to add "print path" script(option) to the right context menu!..
I did :
http://img853.imageshack.us/img853/6973/59818245.png
http://img847.imageshack.us/img847/8758/37217230.png
the script print located in... (2 Replies)
Hello all,
I have created a script that will remove the first two lines of one text file (body.txt) and then add the text from a different text file (header.txt) directly to the beginning of the freshly modified body.txt file. It is as follows:
#!/bin/bash
## This script will add a header... (2 Replies)
To find all the files in your home directory that have been edited in some way since the last tar file, use this command:
find . -newer backup.tar.gz
Is anyone familiar with an older solution?
looking to identify files older then 15mins across several directories.
thanks,
manny (2 Replies)
How do I add the option to change the path in a menu? I have this script. The user chooses a number and had the option of doing something, looking for log files etc. There is a possibility they might want to look at a different path other than what I have given them such as... (2 Replies)
Hi all,
I am parsing command line options using getopts.
The problem is that mandatory argument options following ":" is taking next option as argument if it is not followed by any argument.
Below is the script:
while getopts :hd:t:s:l:p:f: opt
do
case "$opt" in
-h|-\?)... (2 Replies)
I am very new to scripting.
I have the following script:
for i in `ls -1 | grep $1 | grep -v $2`
do
x=`echo $i | sed 's/\.New/\.Old/g'`
echo mv $i DONE/$x
done
This is taking files from the directory I am in and changing the name from .New to .Old and then echoing the command to move... (2 Replies)
Hi All,
I have installed RH Linux 7.1, windows 2000 and windows ME in the same machine.
There are two booting menu:
Lilo:
Linux
Dos
Dos :
Windows2000
WindowsME
If I want to use windowME, I need to boot lilo and choose dos and final choose windows ME.
Have any... (3 Replies)