Shell Programming
Hello,
i'm completely new to linux and shell programing i'm using linux fedora v.8, bash i want to know how to print argument value depending on other argumet value. ex. i have two txt files the first one includes 2 arguments $1, $2 (these values r entered through program) the second one includes 2 arguments $3, $2 (these values r entered through program) now through shell program the user will enter $3 value, so i want through this value to print $1 value, any help? - then i want to know how to consider each word that entered by user as an argument and how to print the third word (as an ex.) ex. the user will enter this line; test test1 test2 test3 test4 .... so how to print the third word? i hope that my questions are clear thanks in advance |
Quote:
As to the second part: Code:
$ x=(test test1 test2 test3 test4) |
Hello,
thanks a lot for ur response, then about the first question it's as follow i have two txt files; 1- includes the following info. Student_ID , grade class (as one argument). 2- includes the following info. Student_name, student_ID. now the user will enter student name to get grade and class (as text) to insert values for them. ex. { enter student name; moody enter values for grade class; 80 2 } i hope that it's ok now. then about the second one how could i deal with that if i don't know how many arguments i have per line? thanks again |
I smell homework.
|
Hi,
Welcome to LQ! Just a few links that will aid you; Linux Documentation Project Advanced Bash-Scripting Guide Rute Tutorial & Exposition Linux Command Guide LinuxSelfHelp Getting Started with Linux :hattip: The above link and others available from 'Slackware-Links'. More than just SlackwareŽ links! |
Provide actual file examples instead of trying to describe them.
|
All times are GMT -5. The time now is 01:59 AM. |