Tag Info

New answers tagged

3

Your Build Script Method If you want to keep to the "bash build method", then you are probably best off "touching" a file (touch lastbuild) when the build script is ran and completes the build. In addition the build script could then look for the file generated by touch (if it doesn't exist, assume a build is needed), or if it exists use find to see if any ...


4

To disable the writing of access times, you need to mount the filesystem(s) in question with the noatime option. To mount an already mounted filesystem with the noatime option, do the following: mount /home -o remount,noatime To make the change permanent, update your /etc/fstab and add noatime to the options field. For example. Before: ...


1

In the unlikely event that your filesystem is mounted with strictatime or lazytime you could use: find /tools -atime +365 However if your filesystem is mounted with relatime, then this information is not being recorded. This is usually done for performance reasons. You can check using the mount command: $ mount /dev/sda3 on / type ext3 ...


-1

To do this with ls robustly you should not split on anything but the path delimiter - that's what it's for. IFS=/; set -f set -- $(ls -dt ./*) shift That will sort all non-dot files in the current directory and place the results in the shell array $@. Given a POSIX ls, this is not susceptible to any kind of filename mangling whatsoever: special characters ...


1

In zsh it's as easy as array=(*.sh(Nom)) The glob qualifier om causes the matches to be sorted by modification time (newest first), and N forces the array to be empty if there is no match (instead of causing an error). In other shells such as bash, there's no good way of sorting by time. You can use ls -t, but that can break because the output is ...


1

If your AIX has at least Perl 5.9, then you can use the Time::Piece core module to obtain the timezone offset in seconds: perl -MTime::Piece -le '$t=Time::Piece->new;print $t->tzoffset' For a particular timezone, do: TZ=Australia/Darwin perl -MTime::Piece -le '$t=Time::Piece->new;print $t->tzoffset'


1

If your goal is to calculate the difference in hours between UTC/GMT and local time, just ask it this way: UTC=$(date -u +%H) LT=$(date +%H) DIFF=$((UTC - LT)) taking care to note that the result may be negative depending on time of day and relative locations.


2

There is no such thing as "local time in epoch format", date +%s always prints the number of seconds since the epoch, namely since 1970-01-01 UTC. It's the same number in all timezones. However, with most strftime(3) implementations date +%z will print the numeric offset of the specified timezone: $ TZ=Australia/Darwin date +%z +0930 $ TZ=America/Toronto ...



Top 50 recent answers are included