So, I usually face this problem when I'm not using GUI based File Managers. They allow you to auto mount drives when you click on them but when you are using CLI based file managers or no file managers at all, the only way is to mount them through writing commands. I'm a lazy fad and I want this done automatically. So here's a script for that. [ https://gist.github.com/Tafhim/5d0839caca813ae82c97 ].
#!/usr/bin/zsh if [[ "$1" == "" ]] then echo "Please specify a device name"; exit; fi; deviceFile=$1 ## Auto mount only ntfs, fat32, vfat for i in $(ls $deviceFile* | grep '[0-9]$'); do blkid -s UUID -o value $i | read z; blkid -s TYPE -o value $i | read f; echo "$z is $f"; if [[ "$z" != "" && ("$f" == "ntfs" || "$f" == "vfat" || "$f" == "fat32" ) ]] then /usr/bin/udisksctl mount -t $f -b $i # https://help.ubuntu.com/community/AutomaticallyMountPartitions fi; done
No comments:
Post a Comment
Post your comment here. If you want to say something about programming problems, scripts, software etc, please try to be as descriptive as possible.