I am writing a bash script for an automator service that will take a Windows directory location and change it to Mac and open a finder window. It’s working except for when it hits folders with spaces. I have put in to remove them but it won’t work on anything with spaces still. I must have made some sort of syntax mistake.
sed -e 's:\\\\fmg_cifs1\\Dept_Shares:/Volumes/Dept_Shares:' -e 's: :\ :g' -e 's:\\:/:g' | pbcopy
TAG=$(pbpaste)
cd $TAG; open .
This is almost certainly all you have to change:
Quoting fixes everything!
Do you need to use
pbcopyandpbpasteand a variable?As Jonathan pointed out, some of the
sedcommand is unnecessary. Of course, something needs to be fed tosed. This may be all you need: