summaryrefslogtreecommitdiff
path: root/rmw
diff options
context:
space:
mode:
authorfilip <“filip.rabiega@gmail.com”>2025-11-13 18:24:26 +0100
committerfilip <“filip.rabiega@gmail.com”>2025-11-13 18:24:26 +0100
commitafd02bfcce54e3252d356f34c25a155c855f3612 (patch)
tree5281f0e305cfedf541bb63c2cbc7d1b46177a244 /rmw
parentddb3f6c1f736cde398df4cf420d67a2d7e7ee944 (diff)
downloadchadscripts-afd02bfcce54e3252d356f34c25a155c855f3612.tar.gz
chadscripts-afd02bfcce54e3252d356f34c25a155c855f3612.tar.bz2
chadscripts-afd02bfcce54e3252d356f34c25a155c855f3612.zip
renamed fz to dz and rm_whitespaces to rmw
Diffstat (limited to 'rmw')
-rwxr-xr-xrmw24
1 files changed, 24 insertions, 0 deletions
diff --git a/rmw b/rmw
new file mode 100755
index 0000000..6331204
--- /dev/null
+++ b/rmw
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+if [ "$#" -gt 1 ]; then
+ echo "Usage: rm_whitespaces <dir>" >&2
+ exit 1
+fi
+
+if [ "$#" -eq 0 ]; then
+ dir="$(pwd)"
+else
+ dir="$1"
+fi
+
+cd "$dir" || {
+ echo "Couldn't cd to directory. Exiting..." >&2
+ exit 1
+}
+
+for file in "$dir"/*; do
+ newname="$(echo "$file" | sed -e 's/["`”“-]*//g' -e 's/[ \t]+/\_/g')"
+ mv "$file" "$newname"
+done
+
+exit 0