learning how to use shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting learning how to use shell script
# 1  
Old 09-18-2006
learning how to use shell script

hello everyone, i am still trying to get this script to work, but with no luck. It is a little beyond my knowledge of scripting at the moment. The beginner book i have has an exercise listed that asks me to write a script tha allows for user input.

For example " what is your name: " and then you should be able to type your name in.

And right after that it wants you to enter a number with a certain amount of digits in it(3). So it says somthing along the lines of; (the name you entered) " you entered the number ###.

if someone could help show me how this is done i would greatly appreicate it.

Thanks
# 2  
Old 09-18-2006
And that beginner book did not show you how to get user input??
you can read this book and also this page
# 3  
Old 09-18-2006
well first of all you have to tell your environment which shell you are using, suppose your are using the bash shell then the script file would like:

#!/bin/bash

#The beginning of your script code

echo "What is your name ? "
read name
echo "Enter a 3 digit number"
read number
echo "The name you entered is " $name
echo "The number you have entered is " $number

#The end of your script code
# 4  
Old 09-18-2006
thanks for your help everyone

Last edited by bebop1111116; 09-18-2006 at 12:18 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Looking for guidance on learning the shell

Hello everyone! I am a mechanical engineering student from Brazil, and I'm trying to get into numerical simulation in fluid dynamics. A teacher recommended OpenFoam and from what I've been reading, it seems that I need to get familiar with ''the Shell'' at first, and this is why I'm here. I... (2 Replies)
Discussion started by: Heisenflower
2 Replies

2. UNIX for Beginners Questions & Answers

After Learning Shell Scripting

Will it be good to learn 1) Perl or 2) Ruby first? (3 Replies)
Discussion started by: alvinoo
3 Replies

3. Shell Programming and Scripting

self-learning! my korn shell problem

i am a beginner i m learning shell by myself i have problem writing a korn shell that takes an absolute pathname to directory and display all ordinary files in the directory ordered by their length. i was thinking use grep ls sort and sed. maybe, i m wrong! can someone tell me? (2 Replies)
Discussion started by: babuda0059
2 Replies

4. UNIX Desktop Questions & Answers

Unix shell script learning

I am trying to learn Shell scripting in UNIX. Could Any one please suggest on how to get UNIX account or any other free stimulator available for download on which I can practice Unix shell script? Thanks, sam70 (9 Replies)
Discussion started by: sam70
9 Replies

5. Shell Programming and Scripting

Shell scripting book learning.

Hi Which is the most useful shell scripting book. Planning to learn shell scripting.Thanks in advance. (1 Reply)
Discussion started by: arunvellanki
1 Replies

6. Shell Programming and Scripting

Suggested Books for Learning Shell scripting

Hi, I had completed RHCE and i am interested to learn shell scripting. Request you to please let me know which book is best for learning shell scripting or any online website. Thanks & Regards arun (2 Replies)
Discussion started by: Arun.Kakarla
2 Replies

7. UNIX for Dummies Questions & Answers

Learning Tips - UNIX Shell Script

Can any one please provide a fast learning tips to learn UNIX shell scripting? Thanks, Gov (3 Replies)
Discussion started by: Govindh.v
3 Replies

8. Shell Programming and Scripting

A Text for learning the SH shell

Know a very best Text for learning the SH shell (standard shell)?? can you speak a text for me ??? (1 Reply)
Discussion started by: ZINGARO
1 Replies

9. UNIX for Dummies Questions & Answers

Learning to write UNIX Shell Scripts

Hi All, I am relatively new to UNIX. I know some basic commands. I am learning to write shell scripts. My first aim is to connect to a Data Base via shell script. Any ideas on this? Any links, docs which will tell me about scripting?? Thanks VEN (1 Reply)
Discussion started by: VENC22
1 Replies

10. Shell Programming and Scripting

Learning Shell Scripting

I'm new to UNIX and I want to learn Shell Scripting. I want a web site that has Shell Scripting tutorials. Any suggesstions?.? (3 Replies)
Discussion started by: liveapple2000
3 Replies
Login or Register to Ask a Question