https://bugs.kde.org/show_bug.cgi?id=428180
Bug ID: 428180 Summary: A shell script to rename files, which works perfectly in terminal, leaves a leading space in filename Product: dolphin Version: 19.12.3 Platform: Other OS: Linux Status: REPORTED Severity: normal Priority: NOR Component: general Assignee: dolphin-bugs-n...@kde.org Reporter: sadiyumu...@gmail.com CC: kfm-de...@kde.org Target Milestone: --- SUMMARY I have a shell script to use in Dolphin ServiceMenu, cleaning filenames particularly for cross-platform compatibility, which runs as expected in terminal, but when used in a Dolphin ServiceMenu, it leaves a leading space in filename. STEPS TO REPRODUCE 1. Run this command in terminal: touch " a truly <horrible>|"awful" "$'\n'"name with a newline and *globs*, and even a 'single' quote or two?! .txt" 2. And then this command: rename 's/[*\n<|>"[\]]/ /g; s/\?//g; s/\\/ /g; s/ ,/,/g; s/:/-/g; s/\s+/ /g; s/^\s*//; s/\s+\././g; '"s/'//g" * 3. You will see a clean filename if you run this command: ls -N 4. Enter that command in a shell script file, starting with "for filename in "${@}"; do" and ending with " "$filename"; done". 5. Add this shell script file to an appropriate ServiceMenu file. 6. Repeat step 1 and then run this script this time from context menu. OBSERVED RESULT One leading space is left in filename. EXPECTED RESULT No leading space should be left as in terminal. SOFTWARE/OS VERSIONS Windows: macOS: Linux/KDE Plasma: Kubuntu 20.04 (available in About System) KDE Plasma Version: 5.18.5 KDE Frameworks Version: 5.68.0 Qt Version: 5.12.8 ADDITIONAL INFORMATION -- You are receiving this mail because: You are watching all bug changes.