summaryrefslogtreecommitdiff
path: root/dot/local/bin/cutbuffer_push
blob: 62faf7b59817882ff0f83731ac9ed30c7301982d (plain)
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
#!/bin/sh
default_basename=cutbuffer_grab
default_extension=txt
date_format=+%F_%H%M%S

destdir=$HOME/$default_basename

chdir_to_destination()
{
    [ -d "$destdir" ] || mkdir -p "$destdir"
    cd "$destdir"
}

choose_destination()
{
        local stamp basename extension now
        now=$(date "$date_format")
        DESTINATION=$default_basename.$now.$default_extension
}

set -e

chdir_to_destination
choose_destination
xcb -p 0 > "$DESTINATION"