[Gllug] Pipe question

Ben Fitzgerald ben_m_f at yahoo.co.uk
Sun Jan 22 19:17:42 UTC 2006


On Sun, Jan 22, 2006 at 05:22:16PM +0000, Adrian McMenamin wrote:
> How can I do this?
> 
> I am mucking about with buildroot - a set of scripts to automate cross
> compiling - which has a bug in it (which the maintainers say they don't
> have the time to fix) which means that configuration changes don't
> always result in proper rebuilds.
> 
> So I am doing things like this...
> 
> adrian at bossclass:~/buildroot$ locate libpthread.so
> /lib/tls/libpthread.so.0
> /lib/tls/i686/cmov/libpthread.so.0
> /lib/libpthread.so.0
> /usr/lib/libpthread.so
> /usr/lib/nptl/libpthread.so
> /usr/lib64/libpthread.so
> /home/adrian/buildroot/build_sh4/staging_dir/lib/libpthread.so.0
> /home/adrian/buildroot/build_sh4/staging_dir/lib/libpthread.so
> /home/adrian/buildroot/build_sh4/root/lib/libpthread.so.0
> /home/adrian/buildroot/toolchain_build_sh4/uClibc/lib/libpthread.so.0
> /home/adrian/buildroot/toolchain_build_sh4/uClibc/lib/libpthread.so
> /tftpboot/192.168.61.55/lib/libpthread.so.0
> /tftpboot/192.168.61.55/lib/usr/libpthread.so
> /lib64/libpthread.so.0
> 
> followed by
> 
> adrian at bossclass:~/buildroot$ ls
> -lia /home/adrian/buildroot/build_sh4/staging_dir/lib/libpthread.so.0
> 13816042 lrwxrwxrwx  1 adrian adrian 20 2006-01-22
> 17:08 /home/adrian/buildroot/build_sh4/staging_dir/lib/libpthread.so.0
> -> libpthread-0.9.28.so
> 
> To check whether a file has been rebuilt. How can I join the two up with
> a pipe? I cannot seem to find a way to do it, and I admit my shell
> knowledge is poor.
> 
> Adrian

hope I've understood you correctly!

one way (and with shell scripting there are many ways to do most
things):

$ locate mysharedobject.so | while read x; do ls -lia $x ; done

You could use a for loop if you for example you needed to set variables
and didn't want to spawn a subshell with a pipe (not sure if it does
actually spawn a subprocess - looking at strace -f I suspect not -  but
I +am+ sure someone will know on this list):

$ for x in `locate mysharedobject.so`; do ls -lia $x ;done

HTH,

Ben.

-- 
Registered Linux user number 339435
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list