using $PATH with whereis
I notice the whereis command does not use your $PATH variable. In particular it did not find the location of kate. So I decided to try and write an alisas that uses your $PATH variable. this code works
Code:
shane@mainbox ~ $ whereis -B {/usr,/usr/bin,/usr/kde/3.4/bin} -f kate Code:
shane@mainbox ~ $ whereis -B {`echo $PATH | tr ":" ","`} -f kate I would think the above code would expand to this, which does work Code:
shane@mainbox ~ $ whereis -B {/bin,/usr/bin,/usr/local/bin,/opt/bin,/usr/i686-pc-linux-gnu/gcc-bin/3.3.5-20050130,/usr/i386-pc-linux-gnu/gcc-bin/3.3.5,/opt/sun-jdk-1.4.2.08/bin,/opt/sun-jdk-1.4.2.08/jre/bin,/opt/sun-jdk-1.4.2.08/jre/javaws,/usr/qt/3/bin,/usr/kde/3.4/bin,/usr/kde/3.3/bin,/usr/games/bin,/home/shane/bin} -f kate |
try
Code:
whereis -B $(echo $PATH| tr ':' ' ') -f kate |
thanks that works :-)
do you have an explanation why this works(using braces) Code:
whereis -B {/usr,/usr/bin,/usr/kde/3.4/bin} -f kate Code:
shane@mainbox ~ $ whereis -B {$(echo $PATH | tr ':' ',')} -f kate |
now I understand why your method works, because items in commas and braces expand with spaces
Code:
shane@mainbox ~ $ echo {dfg,jjk} Code:
shane@mainbox ~ $ echo {$(echo dfg,ghh)} |
Yes, this is a bash specific brace expansion feature, e.g.:
Code:
a{d,c,b}e Code:
ade ace abe |
I wonder of the maintainers of bash left out being able to use comand subtitution in braces for a specific reason(refering to my failed code).
I also noticed this a few days ago Code:
shane@mainbox ~ $ echo t{yh} |
All times are GMT -5. The time now is 04:41 PM. |