Sponsored Content
Full Discussion: Noob on Unix.
Top Forums UNIX for Dummies Questions & Answers Noob on Unix. Post 302213467 by bobtheb on Thursday 10th of July 2008 06:56:56 AM
Old 07-10-2008
1 #! /bin/sh
2
3 echo
4
5 echo "Welcome to the Profile Search"
6
7 echo
8
9 sleep 3
10
11 echo "Please enter the last name of the person you are searching for"
12
13 echo
14
15 read fname
16
17 echo
18
19 echo "Now enter the first name of the person you are searching for"
20
21 echo
22
23 read lname
24
25 echo
26
27 echo "*****"
28
29 echo
30
31 echo "searching for "$lname $fname. Allow a few seconds.
32
33 echo
34
35 echo "*****"
36
37 sleep 5
38
39 matchrec=$(cat data | grep "^$lname")
40
41 if [ -n "$matchrec" ]
42 then
43
44 echo
45
46 echo "Possible match found..."
47
48 echo
49
50 sleep 5
51
52 fn=$(echo "$matchrec" | cut -d"|" -f2)
53 ln=$(echo "$matchrec" | cut -d"|" -f1)
54
55
56 matchrec=$(cat data | grep"^$number")
57
58 if [ "$fn" = "$fname" ]
59 then
60
61 echo
62
63
64 ge=$(echo "$matchrec" | cut -d"|" -f3)
65 ag=$(echo "$matchrec" | cut -d"|" -f4)
66 tn=$(echo "$matchrec" | cut -d"|" -f5)
67 ms=$(echo "$matchrec" | cut -d"|" -f6)
68 ni=$(echo "$matchrec" | cut -d"|" -f7)
69 jd=$(echo "$matchrec" | cut -d"|" -f8)
70 sa=$(echo "$matchrec" | cut -d"|" -f9)
71 he=$(echo "$matchrec" | cut -d"|" -f10)
72 hl=$(echo "$matchrec" | cut -d"|" -f11)
73
74 echo "Would You Like"
75 echo
76 echo "1.Personal Details?"
77 echo "2.Work Details?"
78
79 read choice
80
81 case "$choice" in
82
83 "1")
84
85 echo "First Name : "$ln
86 echo "Last Name : "$fn
87 echo "Gender : "$ge
88 echo "Age of Person : "$ag
89 echo "Telephone Number : "$tg
90 ;;
91
92 "2")
93
94 echo "First Name : "$ln
95 echo "Last Name : "$fn
96 echo "National Insurance Number : "$ni
97 echo "Job Description : "$ag
98 echo "Salary : "$tg
99 echo "Holidays Entitled : "$he
100 echo "Holidays Left : "$hl
101 ;;
102
103
104 fi
105 fi

any idea why this isnt working ??
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Noob learning Unix: backup commands

I am trying to learn some unix here and i have some question that i would like to ask: What's the most basic backup command? What is the command to pause a backup? What is the command to resume backup? Can we backup a job that is running ? How can we pause the backup of the job and than... (1 Reply)
Discussion started by: lotusx
1 Replies

2. UNIX for Dummies Questions & Answers

I am a unix noob

Hello i am new to this forum. I signed up here really to ask one question. I recentaly got a old unix server from my work and i never really understood what unix is or what is does. Dont get me wrong i and very smart with computers as long as its windows, mac, or linux i can use them all but i... (4 Replies)
Discussion started by: alt+f4
4 Replies

3. UNIX for Dummies Questions & Answers

complete noob

Hi all, This is my first post. I am a complete noobie to the UNIX OS, I have an iMac G5 with the unix shell built in and am interested in learning how to use it to do things useful with it, but have no idea where to start. I have read over the basic commands but they haven't helped me much yet.... (3 Replies)
Discussion started by: avdrummerboy
3 Replies

4. Shell Programming and Scripting

Shell Noob

Hi all, I am trying to write a shell script that will move files from one directory to another, the only thing is I want to to check loads of different source directory and move the files to loads of different directories. I am totally new to shell scripts but not to UNIX (although I would... (16 Replies)
Discussion started by: Sax
16 Replies

5. UNIX for Dummies Questions & Answers

complete unix noob (sorry)

This is my first time in this forum so, Hello to all!!! I have been supporting windows based machines for a few years now and I have been writing batch files to do certain tasks for what seems like an age. I've recently started a new job (as it support) and my new colleagues have said,... (2 Replies)
Discussion started by: Blastman
2 Replies

6. UNIX for Dummies Questions & Answers

Unix Noob, wat do i need etc

Hey everyone I am currently starting University, (Aus) and i am required to study Unix as apart of my study. We have gone through the basics in orientation but here at home they said i can access my files through the 'ssh' command. All i need to know is: - How will my wireless internet be... (2 Replies)
Discussion started by: skylin3fr3ak
2 Replies

7. Shell Programming and Scripting

unix noob help with awk?

Hi I'm really new to this so sorry if this is trivial What I'm trying to do is take a file with 3 columns of numbers and cat all the entries of the second and third columns which have the same entry in the first column into a file with the number from the first column in the name. So say 1... (11 Replies)
Discussion started by: AnnaLynn
11 Replies

8. Linux

noob help needed

i'm having trouble putting together a program :( any help would be much appreciated! Write a Shell Program to automate the process of collecting assignments from the directories of students of any specified class. The person running the program should be able to pass a parameter to the... (1 Reply)
Discussion started by: ace_face
1 Replies

9. SCO

SCO noob please help

hello, sco openserver R5 the following error and it fails to load. init: Command is respawning too rapidily id: vm "/home/bin/stvm.sh" init: Comand..etc id: c02"/etc/start/autostart" its trying to mount car diagnostic program in vmware, the program location is in "start" i think? i... (1 Reply)
Discussion started by: hgibbs8129
1 Replies

10. Shell Programming and Scripting

Cron-Noob

Hi guys! Consider the following PERL script, #!/usr/bin/perl my $userID = `whoami`; open(TMP, ">user.txt"); print TMP "$userID"; close(TMP); Run on the command line it works no problem. Run using crontab it doesn't work. Where do I go to check errors from crontab? I've read things... (25 Replies)
Discussion started by: Jaymoney
25 Replies
echo(1B)					     SunOS/BSD Compatibility Package Commands						  echo(1B)

NAME
echo - echo arguments to standard output SYNOPSIS
/usr/ucb/echo [-n] [argument] DESCRIPTION
echo writes its arguments, separated by BLANKs and terminated by a NEWLINE, to the standard output. echo is useful for producing diagnostics in command files and for sending known data into a pipe, and for displaying the contents of envi- ronment variables. For example, you can use echo to determine how many subdirectories below the root directory (/) is your current directory, as follows: o echo your current-working-directory's full pathname o pipe the output through tr to translate the path's embedded slash-characters into space-characters o pipe that output through wc -w for a count of the names in your path. example% /usr/bin/echo "echo $PWD | tr '/' ' ' | wc -w" See tr(1) and wc(1) for their functionality. The shells csh(1), ksh(1), and sh(1), each have an echo built-in command, which, by default, will have precedence, and will be invoked if the user calls echo without a full pathname. /usr/ucb/echo and csh's echo() have an -n option, but do not understand back-slashed escape characters. sh's echo(), ksh's echo(), and /usr/bin/echo, on the other hand, understand the black-slashed escape characters, and ksh's echo() also understands a as the audible bell character; however, these commands do not have an -n option. OPTIONS
-n Do not add the NEWLINE to the output. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscpu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), echo(1), ksh(1), sh(1), tr(1), wc(1), attributes(5) NOTES
The -n option is a transition aid for BSD applications, and may not be supported in future releases. SunOS 5.11 3 Aug 1994 echo(1B)
All times are GMT -4. The time now is 08:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy