View Single Post
  #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