summaryrefslogtreecommitdiff
path: root/dotfiles/system/.profile.d/dd.sh
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2025-05-08 18:49:34 -0500
committerCraig Jennings <c@cjennings.net>2025-05-08 18:51:59 -0500
commit000e00871830cd15de032c80e2b62946cf19445c (patch)
tree794a7922750472bbe0e024042d6ba84f411fc3e0 /dotfiles/system/.profile.d/dd.sh
parentfe302606931e4bad91c4ed6df81a4403523ba780 (diff)
adding missing dotfiles and folders
- profile.d/ - bashrc - authinfo.gpg - .zsh/
Diffstat (limited to 'dotfiles/system/.profile.d/dd.sh')
-rw-r--r--dotfiles/system/.profile.d/dd.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/dotfiles/system/.profile.d/dd.sh b/dotfiles/system/.profile.d/dd.sh
new file mode 100644
index 0000000..5390a65
--- /dev/null
+++ b/dotfiles/system/.profile.d/dd.sh
@@ -0,0 +1,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\"
+}