How can I automount a network share on macOS Catalina?
This is the article that i used
https://useyourloaf.com/blog/using-the-mac-os-x-automounter/
and my code:
networkPath
persistent=&quot;true&quot;
username
password


function debugEcho () {
  if (true) then
   echo -e $1
  fi
}

shareName=${networkPath##*/}
debugEcho &quot;$shareName&quot;
userPersistent=$username
userPersistent=$(echo &quot;$username&quot; | tr &quot;\\&quot; &quot;;&quot;)
if [[ $username == *&quot;@&quot;* ]]; then
  OIFS=$IFS
  IFS=@
  set -- $username
  user=$1
  domain=$2
  debugEcho &quot;$user $domain&quot;
  userPersistent=&quot;$domain;$user&quot;
  IFS=$OIFS
  debugEcho &quot;$userPersistent&quot;
fi

username=${username//@/&quot;%40&quot;}
debugEcho $username
shareName=&quot;TEST7&quot;

if [[ &quot;$persistent&quot; == &quot;true&quot; ]]; then
  mkdir -p /System/Volumes/Data/mnt
  LINE=&quot;/System/Volumes/Data/mnt/Resources auto_resources&quot;
  FILE='/etc/auto_master'
  grep -qF -- &quot;$LINE&quot; &quot;$FILE&quot; || echo &quot;$LINE&quot; &gt;&gt; &quot;$FILE&quot;
  touch /etc/auto_resources
  LINE=&quot;$shareName -fstype=smbfs ://$userPersistent:$password@$networkPath&quot;
  FILE='/etc/auto_resources'
  grep -qF -- &quot;$LINE&quot; &quot;$FILE&quot; || echo &quot;$LINE&quot; &gt;&gt; &quot;$FILE&quot;
  automount -cv
  open &quot;/System/Volumes/Data/mnt/Resources/&quot;
  path1=&quot;/System/Volumes/Data/mnt/Resources/&quot;
  path2=&quot;~/Desktop/&quot;
  debugEcho &quot;$path1&quot;
  ln -s $path1 $path2

else
  open &quot;smb://$username:$password@$networkPath&quot;

fi