RSS Forums RSS

Script to prompt Linux user for hostname and unique NFS share

Please support our Shell Scripting advertiser: Programming Forums
Reply
Posts: 2
Reputation: Mujzeptu is an unknown quantity at this point 
Solved Threads: 0
Mujzeptu Mujzeptu is offline Offline
Newbie Poster

Script to prompt Linux user for hostname and unique NFS share

  #1  
Nov 20th, 2008
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!
AddThis Social Bookmark Button
Reply With Quote  
Posts: 1,732
Reputation: DimaYasny will become famous soon enough DimaYasny will become famous soon enough 
Solved Threads: 83
Featured Poster
DimaYasny DimaYasny is offline Offline
Posting Virtuoso

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

  #2  
Nov 20th, 2008
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
Real stupidity always beats Artificial Intelligence. (Terry Pratchett)

BA BizMg, MCSE, DCSE, Linux+, Network+
Reply With Quote  
Posts: 2
Reputation: Mujzeptu is an unknown quantity at this point 
Solved Threads: 0
Mujzeptu Mujzeptu is offline Offline
Newbie Poster

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

  #3  
Nov 20th, 2008
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...
Reply With Quote  
Posts: 61
Reputation: Gromit is an unknown quantity at this point 
Solved Threads: 7
Gromit's Avatar
Gromit Gromit is offline Offline
Junior Poster in Training

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

  #4  
Nov 20th, 2008
Check out "read"! It will take the user input and do whatever you want with it.

read -p "what is your name?  " name
echo "Nice to meet you $name"

Hope that helps!
-G
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Other Threads in the Shell Scripting Forum
Views: 1042 | Replies: 3 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:32 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC