DaemonForums  

Go Back   DaemonForums > Miscellaneous > Programming

Programming C, bash, Python, Perl, PHP, Java, you name it.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   (View Single Post)  
Old 9th July 2008
c0mrade's Avatar
c0mrade c0mrade is offline
Port Guard
 
Join Date: May 2008
Posts: 41
Default shell script with input

Hi all,

Here is my shell script
Code:
#!/bin/sh
echo "What is your name"
read name
echo "What is your surname"
read surname

echo "Your name is:${name} and your surname is:${surname}"
How can I modify this script so that I input those two variables from console?Lets say my name is "first" and my surname is "last" . So when I run my script
Code:
./script.sh
and input first and last I get "Your name is:first and your surname is:last". Is it possible to modify the script so that it runs like this
Code:
./script.sh first last
and that I get same output "Your name is:first and your surname is:last" .. Thank you for your answers
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script with zenity bsdnewbie999 OpenBSD General 5 24th April 2009 02:37 AM
shell script-start another process bsdnewbie999 Programming 2 23rd April 2009 07:48 PM
shell script compare md5 sum bsdnewbie999 Programming 1 11th April 2009 02:20 PM
incrementing within a shell script? spiderpig Programming 5 29th September 2008 08:12 PM
Shell Script. bsdnewbie999 Programming 21 15th July 2008 07:54 AM


All times are GMT. The time now is 03:51 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick