bash - Mount shares on a mac from batch files using net use -


i in mixed env , have been tasked mounting shares mac users using created batch scripts windows login.

i have 2 main problems.

  1. trying read netlogon share in script on mac

  2. trying convert net use commands in scripts mac can use.

i've spent of time working on part convert whole net use command usable mac.

i started with:

ifs=' '  arr=($(grep '\\' /users/tjguidry/desktop/tjguidry.bat | tr "[a-z]" "[a-z]")) 

with expected array being (based on file have):

net use n: \\domain\dfs1\share1 /persistent:no net use r: \\domain\dfs1\share2 /persistent:no rem net use o: \\domain\dfs1\share3 /persistent:no rem net use p: "\\domain\dfs1\share4" /persistent:no 

the grep command supposed alone in terminal when output array, first slash in \domain gets cut off , shares start letter "a" (ie \domain\dfs1\admin) cuts off "\a" in output. instead get:

net use n: \domain\dfs1\share1 /persistent:no net use r: \domain\dfs1\share2 /persistent:no rem net use o: \domain\dfs1hare3 /persistent:no rem net use p: "\domain\dfs1hare4" /persistent:no 

i can't seem cut on "\\" try , rid of first put of string no matter how try escape slashes.

ideally i'd transform output smb://domain/dfs1/share1 mac able mount it.

this seems process file input correctly:

ifs=' ' arr=($(grep '\\' /users/tjguidry/desktop/tjguidry.bat | tr "[a-z]" "[a-z]" | sed s:\"::g | sed s:\\\\:\/:g | sed 's|/persistent:no||g' | sed 's|net use [a-z]: ||g') ) 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -