summaryrefslogtreecommitdiff
path: root/dotfiles/system/.profile.d/dd.sh
blob: 5390a65fa487a6a5c44310544c912b7e474030f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

# dd.sh
# Craig Jennings <c@cjennings.net>
# takes input and output files as arguments
# prints parameters needed for dd


dd_with_bs() {
    OUT_DIR=$(dirname "$2")
    if [ ! -e "$1" -o ! -e "$OUT_DIR" ]; then
        echo "$1 or $OUT_DIR doesn't exist"
        return 1
    fi
    IN_BS=$(stat -c "%o" "$1")
    OUT_BS=$(stat -c "%o" "$OUT_DIR")

    echo dd \"if=$1\" \"of=$2\" \"ibs=$IN_BS\" \"obs=$OUT_BS\"
}