*nix Thread, Copy file across variable folder name in Technical; I had to make sure 20 original eeePC 701s to allow access to an intranet page on local server and ...
-
9th March 2009, 07:07 PM #1 Copy file across variable folder name
I had to make sure 20 original eeePC 701s to allow access to an intranet page on local server and so I had to go into Firefox settings and set it to bypass using the RBC proxy server for local addresses and set a consistant default homepage.
After doing a few, I worked out it was easier to copy prefs.js from one machine to a network folder and then copy it onto each of the other machines using the File Manager.
I wanted to knock up a script nut the problem I have is that the folder name keeps changing from machine to machine.
the prefs.js file is held in something like (not got a machine handy now) ...
/user/.mozilla/firefox/variablefoldername/prefs.js
Is there a way of writing a script that can handle the variable foldername and just copy the prefs.js file from
/home/classwork/technical/prefs.js which is an SMB mounted share on the server.
regards
Simon
-
-
IDG Tech News
-
9th March 2009, 08:40 PM #2 It should start something like
Code:
locate prefs.js|grep ^"\/home"
I am just trying to figure out the rest of the regular expression to include firefox and prefs.jf.
-
-
9th March 2009, 09:04 PM #3 For a start, you might find this handy... Advanced Bash-Scripting Guide
I'm a bit lazy so cannot be bothered testing this 
Code:
#!/bin/bash
prefsLocation='locate prefs.js | grep ^"\/home"'
cp /home/classwork/technical/prefs.js $prefsLocation
P.S. You may need to force the filecopy (if the file is read only)
-
-
9th March 2009, 09:06 PM #4 Code:
locate prefs.js|grep ^/home/.*/firefox/.*prefs.js$
This should be a little more robust in the case on my system there is other other prefs.jf from other mozilla products like thunderbird.
Last edited by ChrisH; 9th March 2009 at 09:09 PM.
-
Thanks to ChrisH from:
SimpleSi (9th March 2009)
-
9th March 2009, 09:16 PM #5 
Originally Posted by
ChrisH
Code:
locate prefs.js|grep ^/home/.*/firefox/.*prefs.js$
This should be a little more robust in the case on my system there is other other prefs.jf from other mozilla products like thunderbird.
The following might be better, just incase you've set up more than one user on your netbooks.
Code:
locate prefs.js|grep ^/home/user/.*/firefox/.*prefs.js$
You could also set conditions for it to drop out gracefully if the prefs file isn't found, etc. It depends whether you want something to quickly do the job or something to be more robust for future use.
Oh yeah... the script above also assumes that the SMB share is already mounted.
-
Thanks to Ric_ from:
SimpleSi (9th March 2009)
-
9th March 2009, 10:24 PM #6 I'll have to try these out tmrrw when I'm back there and see what they do 
regards
Simon
-
-
9th March 2009, 11:03 PM #7 hmmm I see what your getting at now
Last edited by ChrisH; 9th March 2009 at 11:25 PM.
-
-
10th March 2009, 10:49 AM #8 I'm getting
Code:
locate: /var/cache/locate/locatedb: No such file or directory

Even if I try and t1.url is in the /home/user directory and I'm in the same directory it gives ther same error msg 
regards
Simon
-
-
10th March 2009, 12:10 PM #9 The find command does the job instead though :
Code:
#!/bin/bash
prefslocation=$(find /home/user/.mozilla/firefox -name prefs.js)
cp /home/user/classwork/technical/prefs.js $prefslocation

regards
Simon
-
-
10th March 2009, 05:10 PM #10 You might need to issue the command
to get it working initially but since you got it working with find
-
-
10th March 2009, 05:41 PM #11 I meant to update this to use find anyway because the locate command doesn't come with all distros (thus this script isn't that useful in other situations).
-
-
10th March 2009, 06:15 PM #12
-
SHARE: 
Similar Threads
-
Replies: 5
Last Post: 29th January 2013, 10:16 AM
-
By MicrodigitUK in forum Scripts
Replies: 2
Last Post: 29th January 2009, 12:43 PM
-
Replies: 2
Last Post: 26th June 2008, 05:46 PM
-
By PiqueABoo in forum Scripts
Replies: 5
Last Post: 13th December 2006, 11:09 PM
-
By tosca925 in forum Scripts
Replies: 4
Last Post: 23rd March 2006, 06:27 AM
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules