i was wondering if there was any program akin to autohotkey for linux, i found one that does text replacement and it's fine but i really liked the stuff you could do with autohotkey, i had an entire popup menu of little tools on windows
Perhaps xdotool (assumming X11 and not wayland, there might be a fork? idk). Random self-reference trivia fact: I never used AHK, heard many great things about it and regretted a lot being on Linux by then. This was ~11 years ago. Then, some years later, at a gig I needed to type pre-formatted emails (like every 2 weeks, answering the same) and for that I used xdotool and assigned the commands as custom shortcuts under KDE :) it was one of my proudest moments towards Open Source Software.
script.sh: line 5: cd: 'baa foo ': No such file or directory
but when I manually enter cd 'baa foo' it works fine.
Why could that be? (the echo retuns something like "foo baa #" .)
It really confuses me that the cd with the exact same string works when I enter it manually. I have allready tried leaving out the quotes in the cd command and escaping the spaces using dir=$(printf %q "${dir}"); before the cd but that did not work either.
tbh I am new to shell scripts so maybe there is something obvious I overlooked.
You're probably over-complicating things. Have you heard about the find -print0 | xargs -0 idiom? all that variable interpolation (dir=${dir:2}) and quoting "'""${dir}""'" is better to be dealt by the built-in shell tools. Or you could write a script for the whole body of that while loop, and then call find . -exec ./action.sh {} \;. Same script could be used with the previously mentioned idiom too, you'd need to use bash -c ./action.sh though. One advantage of "find | xargs" is that you can run these concurrently, paralellizing the action to all your dirs, in groups, of say 4 of them... and so on... it's cool and simple.