doc: git doesn't use git-foo invocations.
[guilt.git] / os.Linux
blobaaebf886147f776cf09bf203697572c3ae7a1a4b
1 # usage: touch_date <unix ts> <file>
2 touch_date()
4         touch -d @$1 "$2"
7 # usage: last_modified <file>
8 last_modified()
10         stat -c "%Y" "$1"
13 # usage: format_last_modified <file>
14 format_last_modified()
16         # must strip nano-second part otherwise git gets very
17         # confused, and makes up strange timestamps from the past
18         # (chances are it decides to interpret it as a unix
19         # timestamp).
20         stat -c "%y" "$1" | sed -e '
21 s/^\([0-9]\{4\}\)-\([0-9]\{2\}\)-\([0-9]\{2\}\) \([0-9]\{2\}\):\([0-9]\{2\}\):\([0-9]\{2\}\)\.[0-9]* \(.*\)$/\1-\2-\3 \4:\5:\6 \7/'
24 # usage: head_n [count]
25 head_n()
27         head -n "$1"
30 # usage: sha1 [file]
31 sha1()
33         if [ $# = 1 ]
34         then
35                 sha1sum "$1"
36         else
37                 sha1sum
38         fi
41 # usage: cp_a <src> <dst>
42 cp_a()
44         cp -a "$1" "$2"
47 # usage: _tac
48 _tac()
50         tac
53 _seq()
55         seq "$@"
56         return $?