man touch (and for the date, man date) -B Hongwei Li wrote:
Hi, I need to write a script to change a file's timestamp. I have this script mytmp: #!/bin/sh cd /tmp/test touch t1 Then, if I run mytmp, file t1 is created with the current timestamp. How to change its timestamp in the script after it is created to a specific date and time? If I want to set the date and time as an argument, e.g. I change the script as: #!/bin/sh newstmp=$1 cd /tmp/test touch t1 and run it as # mytmp "Tue Aug 22 08:30:00 CDT 2006" What should be added in the script to change t1's timestamp to the argument provided? Thanks! Hongwei Li