Register
It is currently Sun Nov 23, 2014 6:06 pm

Help me see where I went wrong please?


All times are UTC - 6 hours


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 PostPosted: Mon Feb 27, 2012 8:35 pm   

Joined: Mon Feb 27, 2012 4:42 pm
Posts: 1
Code:
!#/bin/bash

catdwn=$(cat .dwn.txt)
catdwnf=$(cat .dwnf.txt)

clear
echo "This tool searches content from realchacker.net using lynx and realhacker.net/sitemap.xml, all respect intended. Your search may not include all content, this depends on when the sitemap was last updated. Lynx must be i$
sleep 12
clear
echo "Retrieving Data......"
lynx -dump "http://www.realhacker.net/sitemap.xml" | grep -o "http:.*" >.srch.txt
clear
echo "Got It"
sleep 2
clear
echo "What would you like me to search for you?"
read srch
echo "Results"
grep "$srch" .srch.txt
echo "Please enter the URL from above that you want me to use."
read url
clear
echo "Thank you, what would you like done with this URL? I can do one of the following two options: l = Open in lynx, d = If the URL contains a file your interested in, I can download this for you using wget. Please enter the$
read actn
clear

if [ "$actn"="l" ];
then
   echo "Opening URL in lynx, I am not responsible for what you do with this information. I suggest you get explicit permision from the owner of any hardware and or software you may be tampering with, enjoy!"
   sleep 5
   lynx "$url"
   fi

if [ "$actn"="d" ];
then
   echo "Downloading file using wget, I am not responsible for what you do with this file. I suggest you get explicit permision from the owner of any hardware and or software you may be tampering with, enjoy!"
   sleep 5
   lynx -dump "$url" | grep -o "http://packetstormsecurity.org/files/.*" >.dwn.txt | cat .dwn.txt  | lynx -dump "$catdwn"  | grep -o "http://packetstormsecurity.org/files/download/.*" >.dwnf.txt | wget "$catdwnf"
   fi


script breaks after second pipe in bottom if/then statement. also first if/then runs no matter if second if/then is selected with d option or not...those $'s arent really there in echo's nano broke off that text


Top
 Profile  
 PostPosted: Tue Feb 28, 2012 3:51 am   
Moderator
User avatar

Joined: Thu Oct 11, 2007 7:12 am
Posts: 229
Location: London - UK
Hi,

= assigns a value, you mean to compare values with your if statements so == should do.

Code:
if [ "$actn" == "l" ]


DW


Top
 Profile  
 PostPosted: Tue Feb 28, 2012 6:21 am   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 567
hi,

the problem is less to have one or two equal sign, rather than to have spaces around the only one needed.

no spaces : assignment
test with spaces : ... test :)


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP