Programming :: Communication Between Bash And Firefox
Aug 24, 2010
I have been able to use bash to initiate a google seache via firefox. I would like to either copy the source page to a file via wget or send firefox short cuts to the other terminal's firefox search page to put the html file in a directory. I seem to remember but maybe incorrectly that there exist hexadecimal codes for each keyboard shortcut in firefox. Maybe these could be echo-ed from bash to the firefox search page.
When I attempt to extract some webpages there are far too many jscript functions and html encodings. Hence, I can manually search the page, perform select all (^A), copy (^C) it, open a prepared file (^O), but cannot figure how to paste it (&V). I want to do this from a bash script. I know how to do the search. Now how do I send these shortcuts (especially ctrl-C) to Firefox. Once I have the page copied to the clipboard, I think I can figure out how to open a file and save the clipboard to a file using bash script on the Linux side. How do I send shortcuts to Firefox? Is this done with the hex equivalent of the keystrokes?
I am relatively new to scripting, but I was wanting to open a firefox window from a bash script, but have it open, then minimize. In the script, I have a single instance of: firefox & but is there a way to minimize it, versus have it displayed on the screen? I was wanting the command terminal to remain visible and it can't since the firefox window is open in front of it. I looked all over the place, including the man pages, but to no avail. I can make the height and width changes, but no minimize. Either that, or to be able to bring the terminal window back to the front automatically.
I would like to send struct data from process A to process B but I dont known what is the best way. I have read about IPC, but there are a lot of ways to do it.
I have two classes, for argument's sake A and B. A implements the core functionality, B is an encapsulated data structure. If you imagine this situation [code]...
From within B's member functions, I would like to access the public function() in class A. This is not an inheritance issue, they are two discrete classes with radically different functionality. Class A makes an object of B.
I am searching for an interprocess communication that is platform and language independent and is two way communication among different processes and the most important thing is the ipc should have the ability to store data until the receiver receives it.
how am I supposed to use this guide. The doc states different messages lengths and formats, as a programmer, how should I utilize these information?Just fyi, my question is a general qns and does not necessarily target to just using netxms, but could be any other opensource as well.
I have an academic simulator software and I want to visualize its output at the same time the simulation is happening. However I want to separate visualization and simulation modules. The simulation data will be held in an array of a size around 0.5M and will be read only to visualization software (but updated regularly by simulator).
- In past I have used shared memory to share small variables among two applications.
- TCP/IP adds the option of having the simulator and visualization applications on separate machines but the implementation will be more difficult.
- I have also thought about an abstraction layer which allows to replace the communication/interconnection layer with other methods later (file/network/shared memory/pipe).
I would like to know how do I print the line # in a script. My requirement is, I have a script which is about ~5000 lines long. If there are any errors happen I just exit. And I would like to add the line # of the script where the error happened.
Code: #!/bin/bash trap "echo 'you got me'" SIGINT SIGTERM # to trap ctrl+c echo "Press ctrl+c during 5 sec loop" for ((i=0;i<5;i++)); do
[Code]...
How come code behaves normally and stops when ctrl+c signal is caught and resumes, but after I use at least one timeout read in the code it looks like, if signal is caught again it doesn't pause the execution but skips the loop. If you remove -t (timeout) option from the read, both loops look the same!
Now in my bash script, I want to get the output /home/user instead of $HOME once read. So far, I have managed to get the $HOME variable but I can't get it to echo the variable. All I get is the output $HOME.
I have written quite a few separate bash & scripts and php scripts that up to now I have run from cron jobs. However I have to estimate how long each takes to run, before running the next and so it probably takes much longer than necessary to run them all. They have to run in order.
Now there are so many I am thinking it would be better to have a master bash script that would run one after the other, but I am not sure how to get the master script to wait before starting to run the next script. Is this possible and is there a command that will make the script wait between bash and php scripts , for them to finish, before running the next?
I think it would be better to count the len and remove 3 chars to right to get the extension, but it can be macintosh filenames with have 4 chars for extensions.
I need to rename the resulted searched files from a loopI have the following code:
find . -name DOC* | while read i do find $i -type f -name '*.txt' done
basically, I am searching for all txt files inside any folder starting with DOC name.this code is working fine with me.I need to rename those .txt files to .txtOLDOS: Ubuntu 10.4Bash shell
I would like to call some firefox macros from bash so that I can manipulate them in some scripts. Does anyone know how to do that?Currently I'm using the imacros firefox add-in
I am trying to write a bash script that sources another bash script. Essentially, I need a few lines to check to see if a certain variable is set. If not, I set it manually, and then source a scripts with that variable in the path. I wrote a test script to try it, but for some reason the last line does not work. Here is what I wrote:
#!/bin/sh source ~setupdir/setup.shrc #just a test, this line works echo ${#SETUP} # prints 0 if setup is not set, which it isn't if [ ${#SETUP} -eq 0 ] then SETUP="~setupdir" fi echo $SETUP # prints ~setupdir
If one re-boots an openSUSE computer with open Firefox, the Firefox restarts when the system restarts. Actually, every application that was open, restarts.However, sometimes, Firefox does not restart.When I perform ps in bash, I see a few Firefox processes do run, but there is no graphical evidence.If I run Firefox explicitly - stll, no graphical evidence.If, however, I kill all Firefox processes, it can now be started normally.Does someone know a reason for such peculiar behavior ?
I have been having a freaky experience where Firefox appears to freeze up and brings down the terminal and any process viewer with it. For example, I can open a gnome-terminal or xterm window, but the moment I press a key, that window freezes up as well and must be force-quitted with the Force Quit panel applet. In addition, the System Monitor applet I have on my top panel freezes. It's really weird.
I began having this problem around a month or two ago. I thought it was something to do with something I installed, so a week or so ago I did a clean install, backing up my documents, Firefox profile, and GNOME settings from the old installation but wiping everything else (I'd already ruled out the Firefox profile by renaming the folder and creating a new one from the profile manager). Yet the problem persists.
I'd be happy to post any output, but as bash (including Ctrl+Alt+F1 command line) freezes as well, it's a little hard to treat the problem when it happens. One more thing: I am on a university campus which uses 802.1x encryption on both wired and wireless connections; is it possible that that is causing the crashes?
How can I open the Firefox Profile Manager. I've googled and read but the directions don't work for me:
randymanme@randymanme-desktop:~$ /usr/lib/mozilla/firefox -ProfileManager bash: /usr/lib/mozilla/firefox: No such file or directory randymanme@randymanme-desktop:~$ /home/randymanme/mozilla/firefox -ProfileManager
i'm in the process of learing C++. currently i'm creating shell scripts to get things done. i'm just curious how, as a programmer using C++ you would get a similar job done.as an example i have a script that takes the contents of files, pipes it to some sed and awk commands, which is piped to create a new file. that file is then imported into a mysql database.if you were going to do this in C++, would you call the sed/awk programs to modify the file, or can it be done within the program itself? i'm probably jumping the gun here because i've just started learing about pointers so this is above my ability
I am in verse to understand the serial communication between guest and host.I have just added a serial port through VI Client selecting "Use serial port on host"(host being ESX host).If I am on VM and run :
ll > /dev/ttyS0
I understand that it should get displayed through ESX Host. So On ESX Host, I typed:
How do you interface with the Linux I2C driver from kernel space? For example, if I had LEDs connected to a GPIO expander on the I2C bus, how would I blink them twice before going down for reset from machine_reset()?
Essentially, I believe I need to call the functions i2c_smbus_write_byte(), i2c_smbus_read_byte(), etc. But these functions require I2C client data that I do not understand how to supply.
I am writing a code which communicates between 2 processes created by fork() statement. Parent reads a file and write the data into a shared memory and sends a signal to the child. The child then receives a signal from the parent to start reading. After finishing the read operation the child sends a signal to the parent asking it to resume its action. Some things are going wrong in my code.
1. segmentation error in memcpy() statement. 2. terminal hangs after running the code. 3. Synchronization problem between processes..
I'm running Fedora11 OS on my desktop.my HSPA USB modem(Prolink PHS101 HSPA modem)is not detected as communication device. it detected as a CD ROM. could you please tell me the way to make functioning of it in Fedora 11 how to switch to communication mode.
I have two ethernet card on my computer, I want to make a TCP or UDP communication between these two cards, so I disable loopback: #ifconfig lo down. but with out loopback I can't even ping an eth from another one. how should I do? I want traffic to really pass eth cards.
Has anybody tried to get the USB server 'LANSER-E1' from 'MRT Communication' working in Linux ? It works OK in Windows but I have failed to get it working in Debian Sid.
The Server in the above diagram can be accessed by Client3 and Client4 but not at all by Client1 or Client2. Router0 specifies the Server as a DMZ Host. I would be more specific but this is not my server. I don't use a DMZ, I forward ports when they are needed. In this case I represent ISP1 and the server belongs to a befuddled client. Client1 & Client2 can send packets to each other, no problem. Could the DMZ be breaking communication between the Server and Clients 1 & 2?