summaryrefslogtreecommitdiff
path: root/dot/local/bin/cutbuffer_push
blob: cad9367bcd16e687227d843f912a40ea1d3e6ff5 (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
#!/bin/sh
dest_basename=cutbuffer_grab
dest_extension=txt
date_format=+%F_%H%M%S

destdir=$HOME/$dest_basename

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

choose_destination()
{
        now=$(date "$date_format")
        DESTINATION=$dest_basename.$now.$dest_extension
}

set -e

chdir_to_destination
choose_destination
xcb -p 0 > "$DESTINATION"