mounts 609 B

123456789101112131415161718
  1. #!/usr/bin/env bash
  2. MOUNTED=$(shopt -s nullglob dotglob; echo /mnt/share/*)
  3. USER=`whoami`
  4. if (( ${#MOUNTED} )); then
  5. echo "Remote directory already mounted"
  6. else
  7. while !(( ${#MOUNTED} )); do
  8. sudo mount.cifs //corp.wan /mnt/corp -o credentials=/home/$USER/etc/cifs.credo,uid=$USER,forceuid,gid=$USER,forcegid,file_mode=0644,dir_mode=0755,rw,intr,soft,sec=ntlm 2>&1 | grep -q "could not resolve address"
  9. if [ $? = 0 ]; then
  10. echo "Corporate network not available"
  11. break;
  12. fi
  13. MOUNTED=$(shopt -s nullglob dotglob; echo /mnt/share/*)
  14. done
  15. fi