Find the answer to your Linux question:
Results 1 to 3 of 3
Code: #!/bin/bashk=" " i=`rpm -ql mozilla | grep /usr/lib/mozilla- | tail -1 | cut -d/ -f4` echo $i path=`whereis $i |cut -d" " -f2` pathname=$(path) echo $pathname how to use ...
  1. #1
    Linux Newbie
    Join Date
    Feb 2007
    Location
    hyderabad, india
    Posts
    247

    bash script

    Code:
    #!/bin/bashk=" "
    i=`rpm -ql mozilla | grep /usr/lib/mozilla- | tail -1 | cut -d/ -f4`
    echo $i
    path=`whereis $i |cut -d" " -f2`
    pathname=$(path)
    echo $pathname
    how to use out put of "i" in "path" as input.
    i wanna out put like this
    for echo $i
    mozilla-1.7.13

    and
    for echo $pathname
    /usr/lib/mozilla-1.7.13
    how to get this..
    please help me

    thank you in advance
    "Relationships are built on trust and communication"

  2. #2
    Linux Enthusiast
    Join Date
    Aug 2006
    Posts
    631
    Hi,

    There are some possibilities, try it first with bash, you must strip the longest match of the substring from the front of the string.
    Check this page of the abs guide how to extract substrings and help yourself :

    http://tldp.org/LDP/abs/html/string-manipulation.html

    Regards

  3. #3
    Linux Newbie
    Join Date
    Feb 2007
    Location
    hyderabad, india
    Posts
    247
    Quote Originally Posted by Franklin52 View Post
    Hi,

    There are some possibilities, try it first with bash, you must strip the longest match of the substring from the front of the string.
    Check this page of the abs guide how to extract substrings and help yourself :

    http://tldp.org/LDP/abs/html/string-manipulation.html

    Regards
    i trie this in make file
    Code:
    k=" "
    k=`mozilla -V | sed -e 's/\([^,]*\),.*/\L\1/' -e 's/ /-/'`
    path=`whereis $k |cut -d" " -f2`
    mozlib := $(shell $(path))
    am including the lib path like this
    Code:
    gcc -g -O2 -o phone main.o support.o interface.o callbacks.o -L/root/.fedora -L${mozlib}
    
    after making the terminal showing like this
    Code:
    gcc -g -O2 -o phone main.o support.o interface.o callbacks.o -L/root/.fedora -Lmozilla-1.7.13
    here "path" contains the total path of the LIBdirectory...i.e
    /usr/lib/mozilla-1.7.12
    but am getting only
    mozilla-1.7.12 in the make file

    what i have to do to get /usr/lib/mozilla-1.7.12

    thank you in advance
    "Relationships are built on trust and communication"

Posting Permissions

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