Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Help to troubleshoot and correct Post 302475955 by moraks007 on Wednesday 1st of December 2010 02:11:39 AM
Old 12-01-2010
Help to troubleshoot and correct

Reference (to previous post title): Help_Beginner in Unix

I need assistance in terms of troubleshooting this codes.Though it not complete for the required task,shedding of any idea will be appreciated.
the information about the code is the thread referenced above
Code:
Code:
#!/bin/ksh
touch fileuseranswer
 
echo Username
read i
echo Password
read j
Username="${i}:${j}"
 
if ( ! grep -q $Username /$HOME/PhaseTest/userinfo )  syntax error ( & ) should be [ ]
then
        echo "Wrong Login/Passwd"
        exit 2
fi
 
echo "********Welcome to Groucho Marx University********"
date
QFILE=./questions
# max questions
max=$(sed 's/^[1-9][0-9]*\. /#&/' ${QFILE} | nawk -v FS="\n" -v RS="#" 'END {print NR}')
 
question(){
sed 's/^[1-9][0-9]*\. /#&/' ${QFILE} | awk -v FS="\n" -v RS="#" -v VAR="$1" '(NR==VAR){print$0}' | tee q.tmp
#sed -n '/^'`echo "$1"`'\./,/^d) /p' ${QFILE}
 
while :
do
echo "Enter your choice :"
read b
if ( ! grep "$b"')' q.tmp >/dev/null ) ; then
        echo "Invalid choice"
        rm q.tmp
        RC=1 ; break
else
        rm q.tmp
        grep -v ^$1 fileuseranswer >fileuseranswer.tmp
        echo "$1 $a" >>fileuseranswer.tmp
        cat fileuseranswer.tmp >fileuseranswer
        rm fileuseranswer.tmp
        RC=0 ; break
fi
done
return $RC
}
 
while :
do
print "Enter question number, N for next question, P for previous question or Q for done"
read a
case $a in
        [1-9]*) [[ $a -gt $max ]] && c=$max || c=$a ; question "$c" ;;
        n|N) [[ $c -lt $max ]] && let c+=1 || let c=1 ; question "$c" ;;
        p|P) [[ $c -ge 1 ]] && let c-=1 || let c=$max ; question "$c" ;;
        q|Q) exit 0 ;;
        *) echo "Wrong choice , try again" ;;
esac
done

thanks

---------- Post updated 12-01-10 at 09:11 AM ---------- Previous update was 11-30-10 at 06:31 PM ----------

1)Please explain or show what the correct line of code should be.
2)notice this error highlighted in the terminal when running the code:
Warning: unknown mime-type for "Enter question number, N for next question, P for previous question or Q for done" -- using "application/octet-stream"
Error: no such file "Enter question number, N for next question, P for previous question or Q for done"

how can I resolve this error.


thanks

Last edited by jim mcnamara; 11-30-2010 at 12:59 PM.. Reason: use code tags, added one hint
 

8 More Discussions You Might Find Interesting

1. Solaris

AUTOFS - Troubleshoot directory does not exist

How to troubleshoot autofs /mnt/sum: does not exist in one of the sun server? This was working previously. No issue on NFS mounting. root@devapp # cat /etc/dfs/dfstab share -F nfs -o rw /linxnet/server2 # Master map for automounter # +auto_master /net -hosts ... (7 Replies)
Discussion started by: KhawHL
7 Replies

2. AIX

troubleshoot

Dear friends, is there any kind of scripts that will damage aix than we can troubleshoot what was the reason :-) just for having fun :-) (2 Replies)
Discussion started by: Vit0_Corleone
2 Replies

3. UNIX for Advanced & Expert Users

High load average troubleshoot

Hi all, hope you can help me. I'm getting high load average and can't find a reason for this, please share your inputs. load average: 7.78, 7.50, 7.31 Tasks: 330 total, 1 running, 329 sleeping, 0 stopped, 0 zombie Cpu0 : 7.0%us, 1.0%sy, 0.0%ni, 23.9%id, 0.0%wa, 38.9%hi,... (4 Replies)
Discussion started by: erick_tuk
4 Replies

4. SuSE

Link Mount Servers Troubleshoot

Hi i was wondering if it's possible for a folder to show files from different folders. Like, folder A to show files from folder B and folder C With Folder A and Folder B being on one server and Folder C being on another server. I Mounted Folder C on the first server (let's call it B2).... (1 Reply)
Discussion started by: hernanimudaniss
1 Replies

5. Red Hat

How to troubleshoot a 1000 nodes Apache cluster?

Hi all. May I get some expert advice on troubleshooting performance issues of a 1000 nodes Apache LB cluster. Users report slow loading/response of webpages. Different websites are hosted on this cluster for different clients. But all are reporting the same issue. Could you please let me know... (1 Reply)
Discussion started by: admin_xor
1 Replies

6. UNIX for Advanced & Expert Users

Application keep on crashing need to troubleshoot

Hi experts, I am using RHEL as my distro and I have a very important application running on that server. That application is a third party application and I don't have control with the source. That application keeps on crashing or stop like every other day and it doesn't have any traces on... (1 Reply)
Discussion started by: cwiggler
1 Replies

7. UNIX for Dummies Questions & Answers

How to Troubleshoot the mail sending problem?

I am trying to send a mail through terminal from last week still now I can't able to send it.If there is any resolution Please help me out of this problem.It is very urgent . mail -s "check" upload.xxx@example.com < /root/mail.txt # tail -15 /var/log/maillog Sep 19 16:52:04 edms032... (15 Replies)
Discussion started by: kannansoft1985
15 Replies

8. Solaris

Error trying to promote ZFS clone - what do I need to do to troubleshoot this?

Steps taken:- 1. Snapshot an existing ZFS filesystem. 2. Created clone from snapshot. 3. Updated files on cloned ZFS filesystem. 4. Snapshot of cloned ZFS filesystem. 5. Attempted to promote clone ZFS and get error message. See below. #zfs list -rt all /rpool/ai NAME ... (2 Replies)
Discussion started by: psychocandy
2 Replies
Jifty::Manual::TutorialRest(3pm)			User Contributed Perl Documentation			  Jifty::Manual::TutorialRest(3pm)

NAME
Jifty::Manual::TutorialRest - Web Services DESCRIPTION
This builds on Jifty::Manual::Tutorial, so make sure you have a running jifty that roughly resembles the step-by-step from there. SETUP
You must add this to your site_config.yml framework: Plugins: - REST: {} See Jifty::Plugin::REST. The commands assume that you have LWP installed with the GET alias. If not, you'll need to use the longhand lwp-request -m GET, or curl, or your browser. help Make sure it is working: $ GET http://localhost:8888/=/help Accessing resources: ... You should see some text describing the services, not html (that's longhand for 404.) Check the config and restart the server. GET
Just list the models. $ GET http://localhost:8888/=/model.yml --- - MyWeblog.Model.Post List the Post schema. $ GET http://localhost:8888/=/model/Post.yml --- body: label: Content name: body readable: 1 sort_order: 1 type: text writable: 1 id: mandatory: 1 name: id readable: 1 type: serial writable: 0 title: default: Untitled post label: Title name: title readable: 1 sort_order: 0 type: text writable: 1 You did make some posts, right? $ GET http://localhost:8888/=/model/Post/id.yml --- - 1 - 2 Dump the data: $ GET http://localhost:8888/=/model/Post/id/1.yml --- body: 'This is my post, the content of which is this, which is mine.' id: 1 title: my first post $ GET http://localhost:8888/=/model/Post/id/2.yml --- body: "Content of another post. Got to go, the cat's on fire." id: 2 title: post deux POST
TODO not working Actually, it looks like it is not supposed to work this way. Why not? $ echo '--- body: "A post via web services" id: 3 title: "posting from the command-line" ' | lwp-request -m POST http://localhost:8888/=/model/Post.yml POST http://localhost:8888/=/model/Post/id/3.yml --> 404 Not Found PUT
TODO not working $ echo '--- title: "posting from the cli" ' | lwp-request -m PUT http://localhost:8888/=/model/Post/3.yml 500 Can't read entity body: Connection reset by peer DELETE
$ lwp-request -m DELETE http://localhost:8888/=/model/Post/id/3.yml --- content: {} error: ~ field_errors: {} field_warnings: {} message: Deleted success: 1 perl v5.14.2 2010-09-25 Jifty::Manual::TutorialRest(3pm)
All times are GMT -4. The time now is 10:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy