Greetings,
Im trying to turn an AD user profile path into a compatible OSX accepted path. I copied a script from another site and changed it a bit to get the result I wanted but due to my major lack of knowledge in mac scripting its not working properly. As you can see from below, the first few commands give me what I want but when it comes to setting the MacFormattedDirectory variable it goes wrong. Please can anyone review the below commands and let me know where Im going wrong.
Thanks
My question is though its running the same command why is the result different when im setting the MacFormattedDirectory variable (which is what i need to be able to do)?
Thanks
Im trying to turn an AD user profile path into a compatible OSX accepted path. I copied a script from another site and changed it a bit to get the result I wanted but due to my major lack of knowledge in mac scripting its not working properly. As you can see from below, the first few commands give me what I want but when it comes to setting the MacFormattedDirectory variable it goes wrong. Please can anyone review the below commands and let me know where Im going wrong.
Thanks
Code:
WinFormattedDirectory=`dscl /Active\ Directory/DOMAIN/All\ Domains -read /Users/$USER SMBHome | grep \\\\\\\\.* -o`
echo $WinFormattedDirectory returns \\server\homes$\students\2010\test2010 (as expected)
ShortenedWinFormattedDirectory=`echo $WinFormattedDirectory | sed s/\\\\\\\\server/\\\\/Volumes/`
echo $ShortenedWinFormattedDirectory returns \/Volumes\homes$\students\2010\test2010 (works fine, even though i dont really want the first forward slash)
MacFormattedDirectory=`echo $ShortenedWinFormattedDirectory | sed s/\\\\/\\//g`
echo $MacFormattedDirectory returns \Volumes\homes$\students\2010\test2010 (wrong, supposed to turn all backslashes into forwardslashes)
echo $ShortenedWinFormattedDirectory | sed s/\\\\/\\//g
returns //Volumes/homes$/students/2010/test2010 (this is what i am looking for)
My question is though its running the same command why is the result different when im setting the MacFormattedDirectory variable (which is what i need to be able to do)?
Thanks
Last edited by a moderator: