diff options
| author | filip <“filip.rabiega@gmail.com”> | 2025-11-13 18:24:26 +0100 |
|---|---|---|
| committer | filip <“filip.rabiega@gmail.com”> | 2025-11-13 18:24:26 +0100 |
| commit | afd02bfcce54e3252d356f34c25a155c855f3612 (patch) | |
| tree | 5281f0e305cfedf541bb63c2cbc7d1b46177a244 /rmw | |
| parent | ddb3f6c1f736cde398df4cf420d67a2d7e7ee944 (diff) | |
| download | chadscripts-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-x | rmw | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -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 |
