The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shell script getting input from output aspect_p Shell Programming and Scripting 1 03-11-2008 07:37 AM
Input to shell script castlerock Shell Programming and Scripting 3 04-03-2006 05:26 AM
Shell script with input parameter jhmr7 UNIX for Dummies Questions & Answers 1 07-13-2005 12:04 AM
Masking input in a shell script Spetnik UNIX for Dummies Questions & Answers 2 12-29-2003 03:12 PM
single input shell script? quipy Shell Programming and Scripting 1 10-03-2002 08:18 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 07-09-2008
c0mrade c0mrade is offline
Registered User
  
 

Join Date: May 2008
Posts: 35
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
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:13 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0