Help with a simple bash script please

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
salan
Level 2
Level 2
Posts: 83
Joined: Tue Feb 04, 2014 12:13 pm

Help with a simple bash script please

Post by salan »

All,
could some one help me with this script please? I am having a 'senior moment' lol.
Ok so I have a nfs.sh file that I run. It mounts the nfs shares when I want them.
But if some of the shares are not available (machine not on), then I have to wait until it times out on that share.
What I want to have is a script that will ask something like (A)ll?, (b) main shares, (c) other desktops, (d) nas shares. (not that exact wording but you get the idea.
Then I can run this when wanted and choose which shares I want.
Yes I could put the mounts in Fstab but I prefer to have then as a separate script.
Having my senior moment about the basic' menu bit'.
Alan
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
gm10

Re: Help with a simple bash script please

Post by gm10 »

One of many possibilities:

Code: Select all

echo "Which shares to mount?"
select yn in "All" "Main"; do
    case $yn in
        "All")
            echo "Mounting all shares..."
            break;;
        "Main")
            echo "Mounting main shares..."
            break;;
    esac
done
salan
Level 2
Level 2
Posts: 83
Joined: Tue Feb 04, 2014 12:13 pm

Re: Help with a simple bash script please

Post by salan »

Thanks just what I needed. Just got a mental block over it for some reason.
Alan
Locked

Return to “Scripts & Bash”