943,823 Members | Top Members by Rank

Ad:
Nov 20th, 2008
0

Script to prompt Linux user for hostname and unique NFS share

Expand Post »
As the title suggests, I am wanting to create a simple script for system administrators.

When you run this script in a linux shell, it will ask you what you want to set the local systems hostname to (so the admin can type it) and then prompt the administrator for a unique NFS path.

This way the administrator can use one image and then run this script to set the unique hostname, and then set up a local path like /mnt/nfsserver so it connects to the remote NFS server at its unique directory. This way the image doesnt have all workstations connect to the same NFS share... we want each workstation to have its own unique NFS share for their own data.

Any help or code you can provide for me? Im guessing its simple I am just not very good at shell scripting.

Thanks!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Mujzeptu is offline Offline
2 posts
since Nov 2008
Nov 20th, 2008
0

Re: Script to prompt Linux user for hostname and unique NFS share

are you expecting a ready script? if so, seach on google. if not, and you have a script that doesn't work, post it here, and we will try to see if we can help fix it
Moderator
Featured Poster
Reputation Points: 183
Solved Threads: 89
Posting Virtuoso
DimaYasny is offline Offline
1,772 posts
since Jan 2007
Nov 20th, 2008
0

Re: Script to prompt Linux user for hostname and unique NFS share

Well, I have looked on google and am not finding much.

While I would appreciate someone making me the script, I am fine figuring out the commands and such.

The REAL issue I have that I want someone to "show me the code" on is how do I have a shell script prompt for user input to insert the command? I am just used to automatically running a command, but have never had to prompt for user input...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Mujzeptu is offline Offline
2 posts
since Nov 2008
Nov 20th, 2008
0

Re: Script to prompt Linux user for hostname and unique NFS share

Check out "read"! It will take the user input and do whatever you want with it.

Shell Scripting Syntax (Toggle Plain Text)
  1. read -p "what is your name? " name
  2. echo "Nice to meet you $name"

Hope that helps!
-G
Reputation Points: 46
Solved Threads: 28
Junior Poster
Gromit is offline Offline
183 posts
since Sep 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Shell Scripting Forum Timeline: executing a script remotely
Next Thread in Shell Scripting Forum Timeline: copying multiple files with user input





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC