-
Notifications
You must be signed in to change notification settings - Fork 11
/
os.SunOS
57 lines (50 loc) · 821 Bytes
/
os.SunOS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# usage: touch_date <unix ts> <file>
touch_date()
{
touch -d @$1 "$2"
}
# usage: last_modified <file>
last_modified()
{
stat -c "%Y" "$1"
}
# usage: format_last_modified <file>
format_last_modified()
{
# must strip nano-second part otherwise git gets very
# confused, and makes up strange timestamps from the past
# (chances are it decides to interpret it as a unix
# timestamp).
stat -c "%y" "$1" | sed -e '
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/'
}
# usage: head_n [count]
head_n()
{
head -n "$1"
}
# usage: sha1 [file]
sha1()
{
if [ $# = 1 ]
then
sha1sum "$1"
else
sha1sum
fi
}
# usage: cp_a <src> <dst>
cp_a()
{
/usr/bin/cp -a "$1" "$2"
}
# usage: _tac
_tac()
{
tac
}
_seq()
{
seq "$@"
return $?
}