View Single Post
  #18  
Old 17th March 2006, 06:11
mchow mchow is offline
Junior Member
 
Join Date: Mar 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The reason for "cp: cannot create regular file..." errors is because mkdir can't create directories more than 2 levels deep. You have to change the line to "mkdir -p" and then everything will work. I think you can ignore the "cp: cannot stat `(0xffffe000)' messages.

Code:
APPS="/bin/bash /bin/ls /bin/mkdir /bin/mv /bin/pwd /bin/rm /usr/bin/id /usr/bin/ssh /bin/ping"
for prog in $APPS; do
    cp $prog ./$prog
    # obtain a list of related libraries
     ldd $prog > /dev/null
     if [ "$?" = 0 ] ; then
         LIBS=`ldd $prog | awk '{ print $3 }'`
         for l in $LIBS; do
              mkdir -p ./`dirname $l` > /dev/null 2>&1
              cp $l ./$l
         done
     fi
 done

Last edited by mchow; 17th March 2006 at 08:42.
Reply With Quote