| | |
Script to prompt Linux user for hostname and unique NFS share
![]() |
•
•
Join Date: Nov 2008
Posts: 2
Reputation:
Solved Threads: 0
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!
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!
•
•
Join Date: Nov 2008
Posts: 2
Reputation:
Solved Threads: 0
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...
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...
Check out "read"! It will take the user input and do whatever you want with it.
Hope that helps!
-G
Shell Scripting Syntax (Toggle Plain Text)
read -p "what is your name? " name echo "Nice to meet you $name"
Hope that helps!
-G
![]() |
Other Threads in the Shell Scripting Forum
- Previous Thread: executing a script remotely
- Next Thread: copying multiple files with user input
| Thread Tools | Search this Thread |






