Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2011

    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.


  2. #2
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Harrow, UK
    I found that this
    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!"

  3. #3
    Just Joined!
    Join Date
    Feb 2011
    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

Posting Permissions

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