LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-20-2014, 10:34 AM   #1
foooooooofa
LQ Newbie
 
Registered: Dec 2014
Posts: 4

Rep: Reputation: Disabled
web pages !


hey

i got the question :

Write a script that implements a simple web browser (in text mode), using wget and
links -dump to display HTML pages to the user. The user has 3 choices: enter a URL,
enter b for back and q to quit. The last 10 URLs entered by the user are stored in an
array, from which the user can restore the URL by using the back functionality



i made a shell for one page , and i have the command to make an array for the URLs

can anyone help me to make it together that satisfy the required


my solution :
#!/bin/bash

echo "Enter a URL , or press b to back and q to Quite"
## download a webpage and save it in a var called page
page="$(wget -O - http://www.linuxquestions.org)"
## display page ##

## now pass it to lynx
echo "$page" | lynx -dump -stdin




---------------
the command for an array
declare -a page=10
 
Old 12-20-2014, 01:55 PM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
please do not post your homework!!!

now
if you are STUCK on a specific part
post what you have already done .
Then we can then point you in the right direction

that said

what examples are in the activities / labs/( practice ) in your textbook

hint:
look at loops
 
Old 12-20-2014, 02:04 PM   #3
foooooooofa
LQ Newbie
 
Registered: Dec 2014
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by John VV View Post
please do not post your homework!!!

now
if you are STUCK on a specific part
post what you have already done .
Then we can then point you in the right direction

that said

what examples are in the activities / labs/( practice ) in your textbook

hint:
look at loops
excuse me !
i posted what i done !!
 
Old 12-20-2014, 02:18 PM   #4
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Quote:
Originally Posted by foooooooofa View Post
excuse me !
i posted what i done !!
No tantrums, most of the people here are adults. And he actually tried to help .

Read John_VV's post again and think about his points, specific parts, and his hint about loops...

Most people here will help (even though posting homework is actually against the rules at LQ) but we won't do it for you.

Last edited by astrogeek; 12-20-2014 at 02:22 PM.
 
Old 12-22-2014, 07:22 AM   #5
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by foooooooofa View Post
excuse me !
i posted what i done !!
Yeah ... chill out. Think about what you need to do. Good start on the web page portion. Do some research on how to take input within a BASH script and how to parse that input.

We all get that you did "something" and we all also see the obvious which is that you need to now refine the script, adding to it, to fully satisfy the assignment.

The issue is that you haven't demonstrated that you've tried anything here to process input at all. So from our perspective, you're not "stuck" you haven't even given that part of it the slightest amount of effort and instead asked others to fill in that particular gap. There are plenty of examples and information about BASH programming available.

You were asked to complete about three major tasks: write a BASH script, use wget to access a page, and accept user input.

Now if/when you "try" to process user input and it's not quite going as ideally as you'd either like, or truly need it to work, then post the various attempts you've made and what those results are, as well as the desired result, and you'll likely get very helpful answers.

Example:
  1. "I wanted to print the letter A"
  2. "My first attempt was to say 'print A' and that didn't work"
  3. "My next attempt was to say 'print 0x41' and that didn't work"[*["My next attempt was to say 'echo A' and that sort of worked, but it only put it out to the console, I wanted to put that into a log file"
  4. "When I tried to put it into a log file I did 'echo A > /mylog.txt' and it gave me a permissions error"
That's a made up example where someone tried something a few times, made some progress, but got stuck.

You should follow the link in my signature about how to add [code] tags to your post.

Also on the link for Blog Entries shown under my info, you can see that I have an entry about BASH programming and some tips on debugging scripts as well as writing them. The last code block example showing a BASH function named "present_options" actually takes input and processes it, in a brute force sort of manner, there are more elegant ways to do it, but just saying that there's 'an' example.
 
1 members found this post helpful.
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
3 web domains one displays local but web pages do not show on internet meows Linux - Networking 1 01-19-2013 02:11 PM
Web server sees the pages, but not the folder that has all the images for the pages nortonz Linux - Server 9 05-17-2010 03:04 PM
MS Publisher html pages for new web pages do not open in firefox, any suggestions?? Bwebman Linux - Newbie 3 06-13-2009 10:35 AM
ADSL Router Web configuration pages appears instead of Personal Web Server Pages procyon Linux - Networking 4 12-20-2004 05:44 PM
Can't access Linux web server web pages from LAN client jaydave Linux - Networking 4 03-16-2003 02:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration