Remove multiple CIFS shares using for loop in AIXQemu & AIX 6.1 - what am i missing?How to mass change...

Can I pay my credit card?

301 Redirects what does ([a-z]+)-(.*) and ([0-9]+)-(.*) mean

"Counterexample" for the Inverse function theorem

Why do galaxies collide?

What are the effects of eating many berries from the Goodberry spell per day?

Why does the U.S military use mercenaries?

How does this piece of code determine array size without using sizeof( )?

Square spiral in Mathematica

Single word that parallels "Recent" when discussing the near future

Is there an academic word that means "to split hairs over"?

Solenoid fastest possible release - for how long should reversed polarity be applied?

How does the Heat Metal spell interact with a follow-up Frostbite spell?

What color to choose as "danger" if the main color of my app is red

Refer a string as a field API name

Why is it correct to use ~た in this sentence, even though we're talking about next week?

What kind of action are dodge and disengage?

What dog breeds survive the apocalypse for generations?

How to handle professionally if colleagues has referred his relative and asking to take easy while taking interview

Why use a retrograde orbit?

Find the area of the rectangle

How was the blinking terminal cursor invented?

Does a non-singular matrix have a large minor with disjoint rows and columns and full rank?

How can I safely determine the output voltage and current of a transformer?

What do astronauts do with their trash on the ISS?



Remove multiple CIFS shares using for loop in AIX


Qemu & AIX 6.1 - what am i missing?How to mass change password attributes in AIX uname -rv=3 5 for all users but rootHow to set password for users in AIX using single line command?Automount CIFS shares on boot?Auto-Mounting CIFS Shares on LaptopAIX cifs hostname with underscoreMount CIFS shares as non-root on RHEL7 w/o desktopMount user-specific Samba shares using cifsEquivalent maxdepth for find in AIXAIX OS: File appearance monitoring in a directory






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















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


I am not that good with scripting so I need someone to check if my syntax is correct.










share|improve this question









New contributor



RJ Gellangarin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • You're calling rmcifsmnt which "Removes a CIFS mount from the /etc/filesystems file and unmounts the entry if it is mounted" but only "want to unmount". Which do you want?

    – Jeff Schaller
    21 mins ago




















0















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


I am not that good with scripting so I need someone to check if my syntax is correct.










share|improve this question









New contributor



RJ Gellangarin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • You're calling rmcifsmnt which "Removes a CIFS mount from the /etc/filesystems file and unmounts the entry if it is mounted" but only "want to unmount". Which do you want?

    – Jeff Schaller
    21 mins ago
















0












0








0








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


I am not that good with scripting so I need someone to check if my syntax is correct.










share|improve this question









New contributor



RJ Gellangarin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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


I am not that good with scripting so I need someone to check if my syntax is correct.







aix cifs






share|improve this question









New contributor



RJ Gellangarin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share|improve this question









New contributor



RJ Gellangarin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share|improve this question




share|improve this question








edited 23 mins ago









Jeff Schaller

45.8k1165149




45.8k1165149






New contributor



RJ Gellangarin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








asked 33 mins ago









RJ GellangarinRJ Gellangarin

11




11




New contributor



RJ Gellangarin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




New contributor




RJ Gellangarin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • You're calling rmcifsmnt which "Removes a CIFS mount from the /etc/filesystems file and unmounts the entry if it is mounted" but only "want to unmount". Which do you want?

    – Jeff Schaller
    21 mins ago





















  • You're calling rmcifsmnt which "Removes a CIFS mount from the /etc/filesystems file and unmounts the entry if it is mounted" but only "want to unmount". Which do you want?

    – Jeff Schaller
    21 mins ago



















You're calling rmcifsmnt which "Removes a CIFS mount from the /etc/filesystems file and unmounts the entry if it is mounted" but only "want to unmount". Which do you want?

– Jeff Schaller
21 mins ago







You're calling rmcifsmnt which "Removes a CIFS mount from the /etc/filesystems file and unmounts the entry if it is mounted" but only "want to unmount". Which do you want?

– Jeff Schaller
21 mins ago












1 Answer
1






active

oldest

votes


















0














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


or



< 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 umount or rmcifsmnt commands (at the end).






share|improve this answer
























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });






    RJ Gellangarin is a new contributor. Be nice, and check out our Code of Conduct.










    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f519173%2fremove-multiple-cifs-shares-using-for-loop-in-aix%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    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


    or



    < 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 umount or rmcifsmnt commands (at the end).






    share|improve this answer




























      0














      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


      or



      < 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 umount or rmcifsmnt commands (at the end).






      share|improve this answer


























        0












        0








        0







        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


        or



        < 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 umount or rmcifsmnt commands (at the end).






        share|improve this answer













        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


        or



        < 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 umount or rmcifsmnt commands (at the end).







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 15 mins ago









        Jeff SchallerJeff Schaller

        45.8k1165149




        45.8k1165149






















            RJ Gellangarin is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded


















            RJ Gellangarin is a new contributor. Be nice, and check out our Code of Conduct.













            RJ Gellangarin is a new contributor. Be nice, and check out our Code of Conduct.












            RJ Gellangarin is a new contributor. Be nice, and check out our Code of Conduct.
















            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f519173%2fremove-multiple-cifs-shares-using-for-loop-in-aix%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

            Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

            Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...