Wikipedia:Reference desk/Archives/Computing/2009 May 11

Computing desk
< May 10 << Apr | May | Jun >> May 12 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


May 11 edit

Bash Scripting errors edit

Hello there, I am having a problem with the script below, The script works just fine but it returns some errors. I was wondering how i can make these errors go away. If it helps i am running Ubuntu 9.04. Thank you

SmilyHill (talk) 16:48, 11 May 2009 (UTC)[reply]

Your script seems to be doing something to crack WiFi access. If the access point is not your own, what you are doing could make you very unpopular with your neighbours and could be illegal in some jurisdictions. Astronaut (talk) 17:28, 11 May 2009 (UTC)[reply]
This is very true. I will not dive in to my business practices on a public forum, but i will tell you that i do not break in to anyone's WiFi without their express written permission. SmilyHill (talk) 18:00, 11 May 2009 (UTC)[reply]
I can't do any testing right now, but I think the problem is that in the lines like:
if [ $1 = ]; then
there has to be something on the right side of the equals sign. A common approach is to put an "x" or other symbol on both sides:
if [ x$1 = x ]; then
See if that helps. -- Coneslayer (talk) 18:14, 11 May 2009 (UTC)[reply]

I just tried it, I get the same error.

SmilyHill (talk) 18:23, 11 May 2009 (UTC)[reply]

So presumably you're doing pen testing or something. I'd expect you to be able to fix some simple and obvious bash errors. Hint: RTFM for test. --h2g2bob (talk) 18:27, 11 May 2009 (UTC)[reply]
I am not sure what error's are "obvious". That is why i am here.
I know this script is written in a sloppy way, infact i had to rewrite it for Ubuntu 9.04. If someone know a better way to write this.. or even a way to throw this in a GUI, feel free to let me know. SmilyHill (talk) 18:30, 11 May 2009 (UTC)[reply]
Try some whitespace between your brackets and your expressions inside the [ : = :$VAR ] statements. As for being "obvious", the error messages are telling you exactly which line of code is broken. As mentioned above, fix these lines of code. If you need further help with test statements, type
man test
in the terminal, and you will get all the correct syntax for this type of statement. Nimur (talk) 18:38, 11 May 2009 (UTC)[reply]


That worked. Thank you. SmilyHill (talk) 18:48, 11 May 2009 (UTC)[reply]

Rewrite edit

I'd like to know how i can rewrite this script to accept expressions. What i mean by this is that i would like to type in the following code to run the program:

User@CompName:~$ startaircrack --Mac=00:00:00:00:00 --channel=6 ESSID==12345

Or

User@CompName:~$ startaircrack -m 00:00:00:00:00 -c 6 -e 12345

The reason i'd like to do this is because the order that i give the expressions would not matter;

SmilyHill (talk) 18:48, 11 May 2009 (UTC)[reply]

As you might have already figured out, BASH doesn't have such a feature built-in. You can either write your own argument-parser (think of a simple for-loop to iterate over the input arguments, and some switch statement logic), or find a "library" utility which already does this for more complex argument-lists, with error-handling. Nimur (talk) 18:54, 11 May 2009 (UTC)[reply]
Sure it does. Type "help getopts" or google for bash getopts for tutorials. --Sean 20:00, 11 May 2009 (UTC)[reply]
The most cross-platform way to write an if statement for Bourne-ish shells is:
if [ "X$var" = Xwhatever ]
This will parse correctly whether var is empty, has spaces, etc. You must of course quote the thing on the right if it's got anything weird in it. Also, I can't believe some of the rude responses in this thread. --Sean 20:00, 11 May 2009 (UTC)[reply]
  Resolved

Infinite Boot Loop edit

I am not a computer expert, in fact far from it, I know very little about computers. But I was reading an article the other day about some pranks to play on people using their computers where you formed what they called an "infinite boot loop" where the computer would try to start, then shut down part of the way through, then repeat the process, obviously infinitely if there is a power supply. The article said that in order to stop it all you had to do was to start up in safe mode then delete it. Well, safe mode didn't work either. What I did was create a shortcut on my desktop that said this in the location box - "shutdown -r -t 10 -c "Your Message Here"". Is there any real way to undo this action and how can I get rid of it? Thanks jondn (talk) 19:36, 11 May 2009 (UTC)[reply]

The easiest way is probably to boot from a different medium. This used to be done with floppy disks, but I doubt you have any of those lying around. The most likely candidate is your windows installation CD. If you start up with that in your drive, your computer is likely to boot from the CD, rather than the hard disk. If this doesn't work, you'll need to enter you BIOS and change the boot order. Once you've booted from the windows cd, you can enter recovery mode, which gives you a command prompt, you can type "C:" to change to your hard disk. "dir" to get a list of files and folders in your current location, and "cd foldername" to change to another folder. In Windows Vista, the startup folder is in
C:\users\YourName\AppData\Roaming\Microsoft\Windows\Start Menu
So you would type "c:" hit enter, and then "cd users\YourName\AppData\Roaming\Microsoft\Windows\Start Menu". then you can type "del nameoffile" to delete your shortcut file. risk (talk) 19:50, 11 May 2009 (UTC)[reply]
A different way to do the same thing as suggested above would be to stick your hard drive in someone else's computer, delete the offending file from in there, and then return it to its place in your machine. --Sean 20:03, 11 May 2009 (UTC)[reply]
So is following these instructions different than getting in cmd through safe mode and deleting the file without the disk? A friend of mine was able to get into it and supposedly deleted the file (the next time we looked for it it was gone), but the problem still persists.
Thanks for your help jondn (talk) 22:05, 11 May 2009 (UTC)[reply]
If I understand correctly, you made a shortcut in your Startup folder (not on your desktop, it wouldn't run automatically there) which runs "shutdown -r -t 10". That restarts the computer (-r) after a ten-second warning period (-t 10). One thing you could try, if you're a fast enough typist, is pressing Win+R to open the Run dialog and then typing "shutdown -a" (without the quotes, followed by Enter). You can start typing the command before the ten-second warning dialog comes up, but don't press Enter until it's visible. That will cancel the restart, and then you have unlimited time to hunt down the file before your next restart. If you're using Windows XP or earlier then another solution is to hold down the Shift during the startup process, which will prevent programs in the Startup folder from running. They removed that feature in Vista for some reason.
Am I also to understand that your friend did this to his/her own machine, then undid it by deleting the file, and it's still happening? That makes no sense at all. -- BenRG (talk) 11:44, 12 May 2009 (UTC)[reply]
You could try holding down the shift key during the boot process. I think it is supposed to suppress the running of anything in the Startup folder (at least it did so on older versions of Windows but I haven't heard if this still works on Xp or Vista). Astronaut (talk) 11:57, 12 May 2009 (UTC)[reply]

rss feeds edit

Hello, I am looking for a way to open all linked .html pages in a given rss feed into new tabs automatically in firefox. I would like the system to update the rss feed and when a new .html page appears to open it also in a new tab, but not to open .html pages that have already been opened into new tabs. Thank you —Preceding unsigned comment added by Saving rss feeds (talkcontribs) 20:48, 11 May 2009 (UTC)[reply]

I have an iMacros macro that will open links from a static page, on one particular site. You'd need a script that will monitor the feed, either continuously or at intervals, and be able to identify the new content. I'd love to have one like this myself. If you'd say what scripting or programming experience you have, someone is sure to offer a solution.KoolerStill (talk) 16:32, 12 May 2009 (UTC)[reply]

Future trend of the FCC's regulations in the 2.4-GHz RF spectrums? edit

What is the future trend of this agency's regulations in the 2.4-GHz RF spectrum —Preceding unsigned comment added by 75.151.177.58 (talk) 23:21, 11 May 2009 (UTC)[reply]