summaryrefslogtreecommitdiffstats
path: root/bin/viod
blob: 8bb4c21fa3b18c993a9376f77571078c7700901a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash

editor=vi

if [ $# -eq 0 ]
then
   echo "usage: `basename $0` file"
   exit 1
fi

file=$1

timestamp=`stat -c %y "$file" | cut -d. -f1 | cut -d" " -f1 | awk -F- '{print $1 $2 $3}'``stat -c %y "$file" | cut -d. -f1 | cut -d" " -f2 | awk -F: '{print $1 $2 "." $3}'`

"$editor" "$file"

touch -t $timestamp "$file"