Find the answer to your Linux question:
Results 1 to 3 of 3
Hello People. I have been searching for a solution to the following problem: When my distro of choice updates Firefox web browser, the directory name is '/usr/lib/firefox-<version>'. The problem here ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2011
    Location
    UK
    Posts
    2

    How Do I Copy Files to Dynamic Directories?


    Hello People.
    I have been searching for a solution to the following problem:

    When my distro of choice updates Firefox web browser, the directory name is '/usr/lib/firefox-<version>'.
    The problem here is that the directory name is dynamic by nature and doesn't allow a simple static solution, e.g.
    'cp -rf /usr/local/files/bookmarks.html /usr/lib/firefox/defaults/profile'.

    The same quandary applies when adding extensions, changing prefs etc.
    I have looked at the following commands:-
    find, sed, xargs, grep, awk, fprint.
    Unfortunately my grasp of syntax and programming is very simple at best.
    A nice little BASH script would be ideal.

    Thanks!

  2. #2
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Location
    Harrow, UK
    Posts
    1,259
    I found that this
    Code:
    firefox --version|awk '{print $3}'
    will print out the version number (try firefox --version by itself if you want to see what awk is working on). If you put that in backquotes ` `, it should give you the dynamic part of your directory specification.
    "I'm just a little old lady; don't try to dazzle me with jargon!"
    www.hrussman.entadsl.com

  3. #3
    Just Joined!
    Join Date
    Feb 2011
    Location
    UK
    Posts
    2
    Thank you for your reply.
    Now I need to incorporate '$3' response into something like:-

    cp -rf /usr/local/files/bookmarks.html /usr/lib/firefox-'$3'/defaults/profile.

    Any way I can do this?
    Help greatly appreciated

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •