I want to unmount multiple CIFS shares on my AIX LPAR using for loop. I created a file named cifs.txt containing all CIFS shares. Will my command work?
for i in $(cat cifs.txt); do rmcifsmnt -f $i; done
Your existing loop runs the risk of expanding any wildcards in the filenames and removes the corresponding mount(s) from /etc/filesystems. If the mounts are given, one per line, in cifs.txt, then to unmount them:
< cifs.txt xargs -n 1 umount
< cifs.txt xargs -n 1 rmcifsmnt -N -f
Correspondingly, if you want to unmount them and remove them from /etc/filesystems:
< cifs.txt xargs -n 1 rmcifsmnt -f
xargs will do the work of parsing cifs.txt line-by-line and passing each line as an argument to the
rmcifsmnt commands (at the end).