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 ...
- 07-28-2007 #1Linux Newbie
- Join Date
- Feb 2007
- Location
- hyderabad, india
- Posts
- 247
bash script
how to use out put of "i" in "path" as input.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
i wanna out put like this
how to get this..for echo $i
mozilla-1.7.13
and
for echo $pathname
/usr/lib/mozilla-1.7.13
please help me
thank you in advance"Relationships are built on trust and communication"
- 07-28-2007 #2Linux 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
- 07-28-2007 #3Linux Newbie
- Join Date
- Feb 2007
- Location
- hyderabad, india
- Posts
- 247
i trie this in make file
am including the lib path like thisCode:k=" " k=`mozilla -V | sed -e 's/\([^,]*\),.*/\L\1/' -e 's/ /-/'` path=`whereis $k |cut -d" " -f2` mozlib := $(shell $(path))
after making the terminal showing like thisCode:gcc -g -O2 -o phone main.o support.o interface.o callbacks.o -L/root/.fedora -L${mozlib}
here "path" contains the total path of the LIBdirectory...i.eCode:gcc -g -O2 -o phone main.o support.o interface.o callbacks.o -L/root/.fedora -Lmozilla-1.7.13
/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"


Reply With Quote
