Help with a simple bash script please

Forum rules
Before you post please read how to get help
Post Reply
salan
Level 1
Level 1
Posts: 22
Joined: Tue Feb 04, 2014 12:13 pm

Help with a simple bash script please

Post by salan » Mon Nov 19, 2018 4:47 pm

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

gm10
Level 13
Level 13
Posts: 4597
Joined: Thu Jun 21, 2018 5:11 pm

Re: Help with a simple bash script please

Post by gm10 » Mon Nov 19, 2018 5:12 pm

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 1
Level 1
Posts: 22
Joined: Tue Feb 04, 2014 12:13 pm

Re: Help with a simple bash script please

Post by salan » Mon Nov 19, 2018 5:34 pm

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

Post Reply

Return to “Scripts & Bash”